c647af536773c4434975455dd8ea0d3828508c95
[satune.git] / src / AST / set.h
1 /*
2  * File:   set.h
3  * Author: hamed
4  *
5  * Created on June 13, 2017, 3:01 PM
6  */
7
8 #ifndef SET_H
9 #define SET_H
10
11 #include "classlist.h"
12 #include "structs.h"
13 #include "mymemory.h"
14
15 class Set {
16 public:
17         Set(VarType t);
18         Set(VarType t, uint64_t *elements, uint num);
19         Set(VarType t, uint64_t lowrange, uint64_t highrange);
20         virtual ~Set();
21         bool exists(uint64_t element);
22         uint getSize();
23         VarType getType() {return type;}
24         uint64_t getNewUniqueItem() {return low++;}
25         uint64_t getMemberAt(uint index);
26         uint64_t getElement(uint index);
27         uint getUnionSize(Set *s);
28         virtual bool isMutableSet() {return false;}
29         virtual Set *clone(CSolver *solver, CloneMap *map);
30         virtual void serialize(Serializer *serializer);
31         virtual void print();
32         CMEMALLOC;
33 protected:
34         VarType type;
35         bool isRange;
36         uint64_t low;//also used to count unique items
37         uint64_t high;
38         Vector<uint64_t> *members;
39 };
40
41 int intcompare(const void *p1, const void *p2);
42 #endif/* SET_H */
43