#include "classlist.h"
#include "mymemory.h"
#include "ops.h"
+#include "astops.h"
#include "structs.h"
-#define GETFUNCTIONTYPE(o) (((Function*)o)->type)
-
-struct Function {
+class Function {
+public:
+ Function(FunctionType _type) : type(_type) {}
FunctionType type;
+ virtual ~Function() {}
+ virtual Function *clone(CSolver *solver, CloneMap *map) {ASSERT(0); return NULL;}
+ virtual void serialize(Serializer *serialiezr) = 0;
+ virtual void print() = 0;
+ virtual Set *getRange() = 0;
+ CMEMALLOC;
};
-struct FunctionOperator {
- Function base;
+class FunctionOperator : public Function {
+public:
ArithOp op;
- uint numDomains;
- Set ** domains;
- Set * range;
+ Array<Set *> domains;
+ Set *range;
OverFlowBehavior overflowbehavior;
+ FunctionOperator(ArithOp op, Set **domain, uint numDomain, Set *range, OverFlowBehavior overflowbehavior);
+ uint64_t applyFunctionOperator(uint numVals, uint64_t *values);
+ bool isInRangeFunction(uint64_t val);
+ Function *clone(CSolver *solver, CloneMap *map);
+ virtual void serialize(Serializer *serialiezr);
+ virtual void print();
+ Set *getRange() {return range;}
+ CMEMALLOC;
};
-struct FunctionTable {
- Function base;
- Table* table;
+class FunctionTable : public Function {
+public:
+ Table *table;
+ UndefinedBehavior undefBehavior;
+ FunctionTable (Table *table, UndefinedBehavior behavior);
+ Function *clone(CSolver *solver, CloneMap *map);
+ virtual void serialize(Serializer *serialiezr);
+ virtual void print();
+ Set *getRange();
+ CMEMALLOC;
};
-Function* allocFunctionOperator( ArithOp op, Set ** domain, uint numDomain, Set * range,OverFlowBehavior overflowbehavior);
-Function* allocFunctionTable (Table* table);
-void deleteFunction(Function* This);
-
#endif