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

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

Implemented slab allocator based on the original Parabix StringPool?; intergrated it with RE and Pablo AST nodes.

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_WHILE_H
8#define PS_WHILE_H
9
10#include <pablo/pabloAST.h>
11
12namespace pablo {
13
14class While : public PabloAST {
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 const StatementList & getBody() const {
29        return mBody;
30    }
31    inline void setInclusiveCarryCount(const unsigned count) {
32        mCarryCount = count;
33    }
34    inline unsigned getInclusiveCarryCount() const {
35        return mCarryCount;
36    }
37protected:
38    void* operator new (std::size_t size) noexcept {
39        return mAllocator.allocate(size);
40    }
41    While(PabloAST * expr, StatementList && body)
42    : PabloAST(ClassTypeId::While)
43    , mExpr(expr)
44    , mBody(std::move(body))
45    , mCarryCount(0)
46    {
47
48    }
49private:
50    PabloAST * const    mExpr;
51    StatementList       mBody;
52    unsigned            mCarryCount;
53};
54
55}
56
57#endif // PS_WHILE_H
58
59
Note: See TracBrowser for help on using the repository browser.