Fix tabbing
[satune.git] / src / AST / function.h
index afa713f0e800cd9c3838336b4c1b970643b50c42..5cfbb7d4117a5169312d5910b776b116a3aeb014 100644 (file)
@@ -3,19 +3,23 @@
 #include "classlist.h"
 #include "mymemory.h"
 #include "ops.h"
+#include "astops.h"
 #include "structs.h"
 
-#define GETFUNCTIONTYPE(o) (((Function *)o)->type)
-
 class Function {
- public:
-  Function(FunctionType _type) : type(_type) {}
+public:
+       Function(FunctionType _type) : type(_type) {}
        FunctionType type;
-       MEMALLOC;
+       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;
 };
 
 class FunctionOperator : public Function {
- public:
+public:
        ArithOp op;
        Array<Set *> domains;
        Set *range;
@@ -23,15 +27,23 @@ class FunctionOperator : public Function {
        FunctionOperator(ArithOp op, Set **domain, uint numDomain, Set *range, OverFlowBehavior overflowbehavior);
        uint64_t applyFunctionOperator(uint numVals, uint64_t *values);
        bool isInRangeFunction(uint64_t val);
-       MEMALLOC;
+       Function *clone(CSolver *solver, CloneMap *map);
+       virtual void serialize(Serializer *serialiezr);
+       virtual void print();
+       Set *getRange() {return range;}
+       CMEMALLOC;
 };
 
 class FunctionTable : public Function {
- public:
+public:
        Table *table;
        UndefinedBehavior undefBehavior;
        FunctionTable (Table *table, UndefinedBehavior behavior);
-       MEMALLOC;
+       Function *clone(CSolver *solver, CloneMap *map);
+       virtual void serialize(Serializer *serialiezr);
+       virtual void print();
+       Set *getRange();
+       CMEMALLOC;
 };
 
 #endif