Switch array struct to class
[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 };
16
17 class FunctionOperator : public Function {
18  public:
19         ArithOp op;
20         Array<Set *> domains;
21         Set *range;
22         OverFlowBehavior overflowbehavior;
23         FunctionOperator(ArithOp op, Set **domain, uint numDomain, Set *range, OverFlowBehavior overflowbehavior);
24         uint64_t applyFunctionOperator(uint numVals, uint64_t *values);
25         bool isInRangeFunction(uint64_t val);
26         MEMALLOC;
27 };
28
29 class FunctionTable : public Function {
30  public:
31         Table *table;
32         UndefinedBehavior undefBehavior;
33         FunctionTable (Table *table, UndefinedBehavior behavior);
34         MEMALLOC;
35 };
36
37 #endif