Fix tabbing
[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         inline ElementEncoding *getElementEncoding() { return &encoding; }
18         virtual Element *clone(CSolver *solver, CloneMap *map) {ASSERT(0); return NULL;};
19         virtual void serialize(Serializer *serializer) = 0;
20         virtual void print() = 0;
21         virtual void updateParents() {}
22         virtual Set *getRange() = 0;
23         CMEMALLOC;
24 };
25
26 class ElementSet : public Element {
27 public:
28         ElementSet(ASTNodeType type, Set *s);
29         ElementSet(Set *s);
30         virtual Element *clone(CSolver *solver, CloneMap *map);
31         virtual void serialize(Serializer *serializer);
32         virtual void print();
33         CMEMALLOC;
34         Set *getRange() {return set;}
35 protected:
36         Set *set;
37
38 };
39
40 class ElementConst : public ElementSet {
41 public:
42         ElementConst(uint64_t value, Set *_set);
43         uint64_t value;
44         virtual void serialize(Serializer *serializer);
45         virtual void print();
46         Element *clone(CSolver *solver, CloneMap *map);
47         CMEMALLOC;
48 };
49
50 class ElementFunction : public Element {
51 public:
52         ElementFunction(Function *function, Element **array, uint numArrays, BooleanEdge overflowstatus);
53         Array<Element *> inputs;
54         BooleanEdge overflowstatus;
55         FunctionEncoding functionencoding;
56         Element *clone(CSolver *solver, CloneMap *map);
57         virtual void serialize(Serializer *serializer);
58         virtual void print();
59         Set *getRange();
60         void updateParents();
61         Function *getFunction() {return function;}
62         inline FunctionEncoding *getElementFunctionEncoding() {return &functionencoding;}
63         CMEMALLOC;
64 private:
65         Function *function;
66 };
67
68
69 #endif