c9722a91ed8c0210fc05cb543bd3a85c8701944d
[satune.git] / src / AST / boolean.h
1 #ifndef BOOLEAN_H
2 #define BOOLEAN_H
3 #include "classlist.h"
4 #include "mymemory.h"
5 #include "ops.h"
6 #include "structs.h"
7 #include "astnode.h"
8 #include "functionencoding.h"
9 #include "constraint.h"
10
11 /**
12     This is a little sketchy, but apparently legit.
13     https://www.python.org/dev/peps/pep-3123/ */
14
15 #define GETBOOLEANTYPE(o) (o->type)
16 #define GETBOOLEANPARENTS(o) (&(o->parents))
17 #define GETBOOLEANPOLARITY(b) (b->polarity)
18 #define GETBOOLEANVALUE(b) (b->boolVal)
19
20 class Boolean : public ASTNode {
21 public:
22         Boolean(ASTNodeType _type);
23         virtual ~Boolean() {}
24         Polarity polarity;
25         BooleanValue boolVal;
26         Vector<Boolean *> parents;
27         MEMALLOC;
28 };
29
30 class BooleanVar : public Boolean {
31 public:
32         BooleanVar(VarType t);
33         VarType vtype;
34         Edge var;
35         MEMALLOC;
36 };
37
38 class BooleanOrder : public Boolean {
39 public:
40         BooleanOrder(Order *_order, uint64_t _first, uint64_t _second);
41         Order *order;
42         uint64_t first;
43         uint64_t second;
44         MEMALLOC;
45 };
46
47 class BooleanPredicate : public Boolean {
48 public:
49         BooleanPredicate(Predicate *_predicate, Element **_inputs, uint _numInputs, Boolean *_undefinedStatus);
50         ~BooleanPredicate();
51         Predicate *predicate;
52         FunctionEncoding encoding;
53         Array<Element *> inputs;
54         Boolean *undefStatus;
55         FunctionEncoding *getFunctionEncoding() {return &encoding;}
56         MEMALLOC;
57 };
58
59 class BooleanLogic : public Boolean {
60 public:
61         BooleanLogic(CSolver *solver, LogicOp _op, Boolean **array, uint asize);
62         LogicOp op;
63         Array<Boolean *> inputs;
64         MEMALLOC;
65 };
66 #endif