Bug fix
[satune.git] / src / AST / predicate.h
index f9af5af66b2a937861431ebb0ae8d057e1da50fc..183a96099c9d69157f8a63dc7d4c6bd323a91f36 100644 (file)
@@ -3,28 +3,35 @@
 #include "classlist.h"
 #include "mymemory.h"
 #include "ops.h"
+#include "astops.h"
 #include "structs.h"
+#include "common.h"
 
-#define GETPREDICATETYPE(o) (((Predicate *)(o))->type)
-
-struct Predicate {
+class Predicate {
+public:
+       Predicate(PredicateType _type) : type(_type) {}
+       virtual ~Predicate() {}
+       virtual Predicate *clone(CSolver *solver, CloneMap *map) {ASSERT(0); return NULL;}
        PredicateType type;
+       CMEMALLOC;
 };
 
-struct PredicateOperator {
-       Predicate base;
+class PredicateOperator : public Predicate {
+public:
+       PredicateOperator(CompOp op, Set **domain, uint numDomain);
+       bool evalPredicateOperator(uint64_t *inputs);
+       Predicate *clone(CSolver *solver, CloneMap *map);
        CompOp op;
-       Set ** domains;
-       uint numDomains;
+       Array<Set *> domains;
+       CMEMALLOC;
 };
 
-struct PredicateTable {
-       Predicate base;
-       Table* table;
+class PredicateTable : public Predicate {
+public:
+       PredicateTable(Table *table, UndefinedBehavior undefBehavior);
+       Predicate *clone(CSolver *solver, CloneMap *map);
+       Table *table;
        UndefinedBehavior undefinedbehavior;
+       CMEMALLOC;
 };
-
-
-Predicate* allocPredicate(CompOp op, Set ** domain, uint numDomain);
-void deletePredicate(Predicate* predicate);
 #endif