source: icGREP/icgrep-devel/icgrep/pablo/ps_if.h @ 4640

Last change on this file since 4640 was 4640, checked in by cameron, 4 years ago

Pablo compiler refactoring step

File size: 1.4 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_IF_H
8#define PS_IF_H
9
10#include <pablo/pabloAST.h>
11#include <vector>
12
13namespace pablo {
14
15class Assign;
16
17class If : public Statement {
18    friend class PabloBlock;
19    friend class Statement;
20    friend class Simplifier;
21public:
22    using DefinedVars = std::vector<PabloAST *, VectorAllocator>;
23
24    static inline bool classof(const PabloAST * e) {
25        return e->getClassTypeId() == ClassTypeId::If;
26    }
27    static inline bool classof(const void *) {
28        return false;
29    }
30    virtual ~If() {
31        mDefined.clear();
32    }
33    inline PabloAST * getCondition() const {
34        return getOperand(0);
35    }
36    inline PabloBlock & getBody() {
37        return mBody;
38    }
39    inline  PabloBlock & getBody() const {
40        return mBody;
41    }
42    inline const DefinedVars & getDefined() const {
43        return mDefined;
44    }
45protected:
46    inline DefinedVars & getDefined() {
47        return mDefined;
48    }
49    If(PabloAST * expr, const std::initializer_list<Assign *> definedVars, PabloBlock & body, PabloBlock * parent);
50
51    If(PabloAST * expr, const std::vector<Assign *> & definedVars, PabloBlock & body, PabloBlock * parent);
52private:
53    PabloBlock &    mBody;
54    DefinedVars     mDefined;
55};
56
57}
58
59#endif // PS_IF_H
60
61
Note: See TracBrowser for help on using the repository browser.