Found bug... Don't update parent's list until we know we aren't going to be freed
[satune.git] / src / AST / set.h
index badb28c4b6a165ce2e048fd7b4618ad41a3a4e5c..5a5cdab1748121606e4e5b1bd4ef0afa5e552c1b 100644 (file)
 #include "structs.h"
 #include "mymemory.h"
 
-struct Set {
+class Set {
+public:
+       Set(VarType t);
+       Set(VarType t, uint64_t *elements, uint num);
+       Set(VarType t, uint64_t lowrange, uint64_t highrange);
+       virtual ~Set();
+       bool exists(uint64_t element);
+       uint getSize();
+       VarType getType() {return type;}
+       uint64_t getNewUniqueItem() {return low++;}
+       uint64_t getMemberAt(uint index);
+       uint64_t getElement(uint index);
+       virtual Set *clone(CSolver *solver, CloneMap *map);
+       CMEMALLOC;
+protected:
        VarType type;
        bool isRange;
        uint64_t low;//also used to count unique items
        uint64_t high;
-       VectorInt * members;
-};
+       Vector<uint64_t> *members;
 
+};
 
-Set *allocSet(VarType t, uint64_t * elements, uint num);
-Set * allocSetRange(VarType t, uint64_t lowrange, uint64_t highrange);
-bool existsInSet(Set* set, uint64_t element);
-uint getSetSize(Set* set);
-void deleteSet(Set *set);
 #endif/* SET_H */