edits
[satune.git] / src / AST / function.h
index 3f2a1a9310f2dd077cce62762535455e25c09edb..914c43991926482ffb48886e5b2215625a236e9c 100644 (file)
@@ -5,27 +5,34 @@
 #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