7 #include "functionencoding.h"
8 #include "elementencoding.h"
11 class Element : public ASTNode {
13 Element(ASTNodeType type);
15 Vector<ASTNode *> parents;
16 ElementEncoding encoding;
17 virtual Element *clone(CSolver *solver, CloneMap *map) {ASSERT(0); return NULL;};
18 virtual void serialize(Serializer* serializer) =0;
19 virtual void updateParents() {}
20 virtual Set * getRange() = 0;
24 class ElementSet : public Element {
26 ElementSet(ASTNodeType type, Set *s);
28 virtual Element *clone(CSolver *solver, CloneMap *map);
29 virtual void serialize(Serializer* serializer);
31 Set *getRange() {return set;}
37 class ElementConst : public ElementSet {
39 ElementConst(uint64_t value, Set *_set);
41 virtual void serialize(Serializer* serializer);
42 Element *clone(CSolver *solver, CloneMap *map);
46 class ElementFunction : public Element {
48 ElementFunction(Function *function, Element **array, uint numArrays, BooleanEdge overflowstatus);
49 Array<Element *> inputs;
50 BooleanEdge overflowstatus;
51 FunctionEncoding functionencoding;
52 Element *clone(CSolver *solver, CloneMap *map);
53 virtual void serialize(Serializer* serializer);
56 Function * getFunction() {return function;}
62 static inline ElementEncoding *getElementEncoding(Element *e) {
66 static inline FunctionEncoding *getElementFunctionEncoding(ElementFunction *func) {
67 return &func->functionencoding;