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

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

Minor revisions

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_WHILE_H
8#define PS_WHILE_H
9
10#include <pablo/pe_pabloe.h>
11#include <list>
12
13namespace pablo {
14
15class While : public PabloE {   
16public:
17    typedef std::list<PabloE*> List;
18    friend While * makeWhile(PabloE * expr, List psl);
19
20    static inline bool classof(const PabloE * e) {
21        return e->getClassTypeId() == ClassTypeId::While;
22    }
23    static inline bool classof(const void *) {
24        return false;
25    }
26
27    virtual ~While() {
28        delete mExpr;
29        for (auto statement : mPSList) {
30            delete statement;
31        }
32    }
33
34    inline PabloE * getExpr() const {
35        return mExpr;
36    }
37
38    inline const List & getPSList() const {
39        return mPSList;
40    }
41protected:
42    While(PabloE * expr, List psl)
43    : PabloE(ClassTypeId::While)
44    , mExpr(expr)
45    , mPSList(psl)
46    {
47
48    }
49private:
50    PabloE * const  mExpr;
51    List            mPSList;
52};
53
54inline While * makeWhile(PabloE * cond, While::List statements) {
55    return new While(cond, statements);
56}
57
58}
59
60#endif // PS_WHILE_H
61
62
Note: See TracBrowser for help on using the repository browser.