source: icGREP/icgrep-devel/icgrep/pablo/ps_while.h @ 4276

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

Created an "insertion friendly" Pablo AST structure similar to LLVM; fixed engine builder bug when creating a unicode class.

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_WHILE_H
8#define PS_WHILE_H
9
10#include <pablo/pabloAST.h>
11
12namespace pablo {
13
14class While : public Statement {
15    friend class PabloBlock;
16public:
17    static inline bool classof(const PabloAST * e) {
18        return e->getClassTypeId() == ClassTypeId::While;
19    }
20    static inline bool classof(const void *) {
21        return false;
22    }
23    virtual ~While() {
24    }
25    inline PabloAST * getCondition() const {
26        return mExpr;
27    }
28    inline StatementList & getBody() {
29        return mBody;
30    }
31    inline const StatementList & getBody() const {
32        return mBody;
33    }
34    inline void setInclusiveCarryCount(const unsigned count) {
35        mCarryCount = count;
36    }
37    inline unsigned getInclusiveCarryCount() const {
38        return mCarryCount;
39    }
40protected:
41    void* operator new (std::size_t size) noexcept {
42        return mAllocator.allocate(size);
43    }
44    While(PabloAST * expr, StatementList && body)
45    : Statement(ClassTypeId::While)
46    , mExpr(expr)
47    , mBody(std::move(body))
48    , mCarryCount(0)
49    {
50
51    }
52private:
53    PabloAST * const    mExpr;
54    StatementList       mBody;
55    unsigned            mCarryCount;
56};
57
58}
59
60#endif // PS_WHILE_H
61
62
Note: See TracBrowser for help on using the repository browser.