source: icGREP/icgrep-devel/icgrep/pablo/pe_var.h @ 4214

Last change on this file since 4214 was 4214, checked in by nmedfort, 5 years ago

Partial implementation of 'PabloBuilder?'.

File size: 1.1 KB
Line 
1/*
2 *  Copyright (c) 2014 International Characters.
3 *  This software is licensed to the public under the Open Software License 3.0.
4 *  icgrep is a trademark of International Characters.
5 */
6
7#ifndef PE_VAR_H
8#define PE_VAR_H
9
10#include <pablo/pe_pabloe.h>
11#include <pablo/ps_assign.h>
12#include <pablo/pe_string.h>
13
14namespace pablo {
15
16class Var : public PabloE {
17    friend Var * makeVar(String *);
18    friend Var * makeVar(Assign * assign);
19    friend struct CodeGenState;
20public:
21    static inline bool classof(const PabloE * e) {
22        return e->getClassTypeId() == ClassTypeId::Var;
23    }
24    static inline bool classof(const void *) {
25        return false;
26    }
27    virtual ~Var(){
28    }
29    inline const std::string & getName() const {
30        return *mVar;
31    }
32protected:
33    Var(const PabloE * var)
34    : PabloE(ClassTypeId::Var)
35    , mVar(cast<String>(var)) {
36
37    }
38private:
39    const String * const mVar;
40};
41
42inline Var * makeVar(String * var) {
43    return new Var(var);
44}
45
46inline Var * makeVar(Assign * assign) {
47    return new Var(assign->mName);
48}
49
50}
51
52
53
54#endif // PE_VAR_H
55
56
Note: See TracBrowser for help on using the repository browser.