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

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

Replaced dynamic_cast with llvm::dyn_cast in pablo code; implemented make functions for pablo constructors. Disabled RTTI.

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