#include "ops.h"
#include "structs.h"
-#define GETFUNCTIONTYPE(o) (((Function*)o)->type)
+#define GETFUNCTIONTYPE(o) (((Function *)o)->type)
-struct Function{
- FunctionType type;
+class Function {
+ public:
+ Function(FunctionType _type) : type(_type) {}
+ FunctionType type;
+ MEMALLOC;
};
-struct FunctionOperator {
- Function base;
- ArithOp op;
- VectorSet* domains;
- Set * range;
- OverFlowBehavior overflowbehavior;
+class FunctionOperator : public Function {
+ public:
+ ArithOp op;
+ ArraySet 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);
+ ~FunctionOperator();
+ MEMALLOC;
};
-struct FunctionTable{
- Function base;
- Table* table;
+class FunctionTable : public Function {
+ public:
+ Table *table;
+ UndefinedBehavior undefBehavior;
+ FunctionTable (Table *table, UndefinedBehavior behavior);
+ MEMALLOC;
};
-Function* allocFunctionOperator( ArithOp op, Set ** domain, uint numDomain, Set * range,OverFlowBehavior overflowbehavior);
-Function* allocFunctionTable (Table* table);
-void deleteFunction(Function* This);
-
#endif