Get rid of silly macros
[satune.git] / src / AST / element.h
1 #ifndef ELEMENT_H
2 #define ELEMENT_H
3 #include "classlist.h"
4 #include "mymemory.h"
5 #include "structs.h"
6 #include "astnode.h"
7 #include "functionencoding.h"
8 #include "elementencoding.h"
9 #include "boolean.h"
10
11 class Element : public ASTNode {
12 public:
13         Element(ASTNodeType type);
14         virtual ~Element() {}
15         Vector<ASTNode *> parents;
16         ElementEncoding encoding;
17         virtual Element *clone(CSolver *solver, CloneMap *map) {ASSERT(0); return NULL;};
18         MEMALLOC;
19 };
20
21 class ElementConst : public Element {
22 public:
23         ElementConst(uint64_t value, VarType type, Set *_set);
24         Set *set;
25         uint64_t value;
26         Element *clone(CSolver *solver, CloneMap *map);
27         MEMALLOC;
28 };
29
30 class ElementSet : public Element {
31 public:
32         ElementSet(Set *s);
33         Set *set;
34         Element *clone(CSolver *solver, CloneMap *map);
35         MEMALLOC;
36 };
37
38 class ElementFunction : public Element {
39 public:
40         ElementFunction(Function *function, Element **array, uint numArrays, Boolean *overflowstatus);
41         Function *function;
42         Array<Element *> inputs;
43         Boolean *overflowstatus;
44         FunctionEncoding functionencoding;
45         Element *clone(CSolver *solver, CloneMap *map);
46         MEMALLOC;
47 };
48
49 Set *getElementSet(Element *This);
50
51 static inline ElementEncoding *getElementEncoding(Element *e) {
52         return &e->encoding;
53 }
54
55 static inline FunctionEncoding *getElementFunctionEncoding(ElementFunction *func) {
56         return &func->functionencoding;
57 }
58 #endif