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

Last change on this file since 4543 was 4541, checked in by cameron, 5 years ago

New carry data system -- first stage

File size: 1.3 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;
19public:
20    using DefinedVars = std::vector<PabloAST *, VectorAllocator>;
21
22    static inline bool classof(const PabloAST * e) {
23        return e->getClassTypeId() == ClassTypeId::If;
24    }
25    static inline bool classof(const void *) {
26        return false;
27    }
28    virtual ~If() {
29        mDefined.clear();
30    }
31    inline PabloAST * getCondition() const {
32        return getOperand(0);
33    }
34    inline PabloBlock & getBody() {
35        return mBody;
36    }
37    inline const PabloBlock & getBody() const {
38        return mBody;
39    }
40    inline const DefinedVars & getDefined() const {
41        return mDefined;
42    }
43protected:
44    If(PabloAST * expr, const std::initializer_list<Assign *> definedVars, PabloBlock & body, PabloBlock * parent);
45
46    If(PabloAST * expr, const std::vector<Assign *> & definedVars, PabloBlock & body, PabloBlock * parent);
47private:
48    PabloBlock &    mBody;
49    DefinedVars     mDefined;
50};
51
52}
53
54#endif // PS_IF_H
55
56
Note: See TracBrowser for help on using the repository browser.