Merge branch 'master' of ssh://demsky.eecs.uci.edu/home/git/constraint_compiler into...
[satune.git] / src / AST / element.h
index f563586e77b2b5034ddcc18132cadc072aba5675..544725624c4d4ab3ef6426fd4cc8fba070a756d0 100644 (file)
@@ -8,42 +8,45 @@
 #include "elementencoding.h"
 #include "boolean.h"
 
-#define GETELEMENTTYPE(o) (o->type)
-#define GETELEMENTPARENTS(o) (&((Element *)o)->parents)
 class Element : public ASTNode {
 public:
        Element(ASTNodeType type);
-       virtual ~Element();
+       virtual ~Element() {}
        Vector<ASTNode *> parents;
        ElementEncoding encoding;
-       MEMALLOC;
+       virtual Element *clone(CSolver *solver, CloneMap *map) {ASSERT(0); return NULL;};
+       virtual void updateParents() {}
+       
+       CMEMALLOC;
 };
 
 class ElementConst : public Element {
 public:
-       ElementConst(uint64_t value, VarType type);
-       ~ElementConst();
+       ElementConst(uint64_t value, VarType type, Set *_set);
        Set *set;
        uint64_t value;
-       MEMALLOC;
+       Element *clone(CSolver *solver, CloneMap *map);
+       CMEMALLOC;
 };
 
 class ElementSet : public Element {
 public:
        ElementSet(Set *s);
        Set *set;
-       MEMALLOC;
+       Element *clone(CSolver *solver, CloneMap *map);
+       CMEMALLOC;
 };
 
 class ElementFunction : public Element {
 public:
-       ElementFunction(Function *function, Element **array, uint numArrays, Boolean *overflowstatus);
-       ~ElementFunction();
+       ElementFunction(Function *function, Element **array, uint numArrays, BooleanEdge overflowstatus);
        Function *function;
        Array<Element *> inputs;
-       Boolean *overflowstatus;
+       BooleanEdge overflowstatus;
        FunctionEncoding functionencoding;
-       MEMALLOC;
+       Element *clone(CSolver *solver, CloneMap *map);
+       void updateParents();
+       CMEMALLOC;
 };
 
 Set *getElementSet(Element *This);