source: icGREP/icgrep-devel/icgrep/pablo/ps_assign.h @ 4213

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

Created internal 'string pool' for Call, CharClass?, Var and Assign pablo classes.

File size: 1.2 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 PS_SETMARKER_H
8#define PS_SETMARKER_H
9
10#include <pablo/pe_pabloe.h>
11#include <pablo/pe_string.h>
12
13namespace pablo {
14
15class Var;
16
17class Assign : public PabloE {
18    friend Assign * makeAssign(const String *, PabloE *);
19    friend Var * makeVar(const Assign *);
20public:
21    static inline bool classof(const PabloE * e) {
22        return e->getClassTypeId() == ClassTypeId::Assign;
23    }
24    static inline bool classof(const void *) {
25        return false;
26    }
27    virtual ~Assign() {
28        delete mExpr;
29    }
30
31    inline const std::string & getName() const {
32        return *mName;
33    }
34
35    inline PabloE * getExpr() const {
36        return mExpr;
37    }
38protected:
39    Assign(const String * name, PabloE * expr)
40    : PabloE(ClassTypeId::Assign)
41    , mName(name)
42    , mExpr(expr)
43    {
44
45    }
46private:
47    const String * const    mName;
48    PabloE * const          mExpr;
49};
50
51inline Assign * makeAssign(const String * marker, PabloE * expr) {
52    return new Assign(marker, expr);
53}
54
55}
56
57#endif // PS_SETMARKER_H
58
Note: See TracBrowser for help on using the repository browser.