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 inline ElementEncoding *getElementEncoding() { return &encoding; }
18 inline void freezeElement() {frozen = true;}
19 inline bool isFrozen() {return frozen;}
20 virtual Element *clone(CSolver *solver, CloneMap *map) {ASSERT(0); return NULL;};
21 virtual void serialize(Serializer *serializer) = 0;
22 virtual void print() = 0;
23 virtual void updateParents() {}
24 virtual Set *getRange() = 0;
30 class ElementSet : public Element {
32 ElementSet(ASTNodeType type, Set *s);
33 virtual ~ElementSet() {}
35 virtual Element *clone(CSolver *solver, CloneMap *map);
36 virtual void serialize(Serializer *serializer);
39 Set *getRange() {return set;}
42 friend class ElementOpt;
45 class ElementConst : public ElementSet {
47 ElementConst(uint64_t value, Set *_set);
48 virtual ~ElementConst() {}
50 virtual void serialize(Serializer *serializer);
52 Element *clone(CSolver *solver, CloneMap *map);
56 class ElementFunction : public Element {
58 virtual ~ElementFunction() {}
59 ElementFunction(Function *function, Element **array, uint numArrays, BooleanEdge overflowstatus);
60 Array<Element *> inputs;
61 BooleanEdge overflowstatus;
62 FunctionEncoding functionencoding;
63 Element *clone(CSolver *solver, CloneMap *map);
64 virtual void serialize(Serializer *serializer);
68 Function *getFunction() {return function;}
69 inline FunctionEncoding *getElementFunctionEncoding() {return &functionencoding;}