X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=src%2FAST%2Felement.h;h=91d677fc2b8726ff67aedcbda69338ac2b35c6ad;hb=e1360c75a71486a0de8c1b30a2a8cd2877902416;hp=8277b42b018159b57d896e3234c15217144ba0fb;hpb=9c5f7893454def1fd8899ae8944f414ce442d24e;p=satune.git diff --git a/src/AST/element.h b/src/AST/element.h index 8277b42..91d677f 100644 --- a/src/AST/element.h +++ b/src/AST/element.h @@ -14,46 +14,60 @@ public: virtual ~Element() {} Vector parents; ElementEncoding encoding; + inline ElementEncoding *getElementEncoding() { return &encoding; } virtual Element *clone(CSolver *solver, CloneMap *map) {ASSERT(0); return NULL;}; - - MEMALLOC; + virtual void serialize(Serializer *serializer) = 0; + virtual void print() = 0; + virtual void updateParents() {} + virtual Set *getRange() = 0; + CMEMALLOC; + bool anyValue; }; -class ElementConst : public Element { +class ElementSet : public Element { public: - ElementConst(uint64_t value, VarType type, Set *_set); + ElementSet(ASTNodeType type, Set *s); + virtual ~ElementSet() {} + ElementSet(Set *s); + virtual Element *clone(CSolver *solver, CloneMap *map); + virtual void serialize(Serializer *serializer); + virtual void print(); + CMEMALLOC; + Set *getRange() {return set;} +protected: Set *set; - uint64_t value; - Element *clone(CSolver *solver, CloneMap *map); - MEMALLOC; + friend class ElementOpt; }; -class ElementSet : public Element { +class ElementConst : public ElementSet { public: - ElementSet(Set *s); - Set *set; + ElementConst(uint64_t value, Set *_set); + virtual ~ElementConst() {} + uint64_t value; + virtual void serialize(Serializer *serializer); + virtual void print(); Element *clone(CSolver *solver, CloneMap *map); - MEMALLOC; + CMEMALLOC; }; class ElementFunction : public Element { public: - ElementFunction(Function *function, Element **array, uint numArrays, Boolean *overflowstatus); - Function *function; + virtual ~ElementFunction() {} + ElementFunction(Function *function, Element **array, uint numArrays, BooleanEdge overflowstatus); Array inputs; - Boolean *overflowstatus; + BooleanEdge overflowstatus; FunctionEncoding functionencoding; Element *clone(CSolver *solver, CloneMap *map); - MEMALLOC; + virtual void serialize(Serializer *serializer); + virtual void print(); + Set *getRange(); + void updateParents(); + Function *getFunction() {return function;} + inline FunctionEncoding *getElementFunctionEncoding() {return &functionencoding;} + CMEMALLOC; +private: + Function *function; }; -Set *getElementSet(Element *This); - -static inline ElementEncoding *getElementEncoding(Element *e) { - return &e->encoding; -} -static inline FunctionEncoding *getElementFunctionEncoding(ElementFunction *func) { - return &func->functionencoding; -} #endif