Bug fixes
[satune.git] / src / AST / function.h
1 #ifndef FUNCTION_H
2 #define FUNCTION_H
3 #include "classlist.h"
4 #include "mymemory.h"
5 #include "ops.h"
6 #include "structs.h"
7
8 #define GETFUNCTIONTYPE(o) (((Function *)o)->type)
9
10 class Function {
11  public:
12   Function(FunctionType _type) : type(_type) {}
13         FunctionType type;
14         MEMALLOC;
15         virtual ~Function() {}
16 };
17
18 class FunctionOperator : public Function {
19  public:
20         ArithOp op;
21         Array<Set *> domains;
22         Set *range;
23         OverFlowBehavior overflowbehavior;
24         FunctionOperator(ArithOp op, Set **domain, uint numDomain, Set *range, OverFlowBehavior overflowbehavior);
25         uint64_t applyFunctionOperator(uint numVals, uint64_t *values);
26         bool isInRangeFunction(uint64_t val);
27         MEMALLOC;
28 };
29
30 class FunctionTable : public Function {
31  public:
32         Table *table;
33         UndefinedBehavior undefBehavior;
34         FunctionTable (Table *table, UndefinedBehavior behavior);
35         MEMALLOC;
36 };
37
38 #endif