source: icGREP/icgrep-devel/icgrep/re/re_diff.h @ 4272

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

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

File size: 906 bytes
Line 
1#ifndef RE_DIFF_H
2#define RE_DIFF_H
3
4#include <re/re_re.h>
5
6namespace re {
7
8class Diff : public RE {
9public:
10    static inline bool classof(const RE * re) {
11        return re->getClassTypeId() == ClassTypeId::Diff;
12    }
13    static inline bool classof(const void *) {
14        return false;
15    }
16    RE * getLH() const {
17        return mLh;
18    }
19    void setLH(RE * lh) {
20        mLh = lh;
21    }
22    RE * getRH() const {
23        return mRh;
24    }
25    void setRH(RE * rh) {
26        mRh = rh;
27    }
28protected:
29    friend Diff * makeDiff(RE*, RE*);
30    void* operator new (std::size_t size) noexcept {
31        return mAllocator.allocate(size);
32    }
33    Diff(RE * lh, RE * rh)
34    : RE(ClassTypeId::Diff)
35    , mLh(lh)
36    , mRh(rh)
37    {
38
39    }
40    virtual ~Diff() {}
41private:
42    RE * mLh;
43    RE * mRh;
44};
45
46inline Diff * makeDiff(RE * lh, RE * rh) {
47    return new Diff(lh, rh);
48}
49
50}
51
52#endif // RE_DIFF_H
Note: See TracBrowser for help on using the repository browser.