d958dc02af701afdeb4f47ac578818512e592db8
[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         Polarity polarity;
24         BooleanValue boolVal;
25         Vector<Boolean *> parents;
26         MEMALLOC;
27 };
28
29 class BooleanVar : public Boolean {
30  public:
31         BooleanVar(VarType t);
32         VarType vtype;
33         Edge var;
34         MEMALLOC;
35 };
36
37 class BooleanOrder : public Boolean {
38  public:
39         BooleanOrder(Order *_order, uint64_t _first, uint64_t _second);
40         Order *order;
41         uint64_t first;
42         uint64_t second;
43         MEMALLOC;
44 };
45
46 class BooleanPredicate : public Boolean {
47  public:
48         BooleanPredicate(Predicate *_predicate, Element **_inputs, uint _numInputs, Boolean *_undefinedStatus);
49         ~BooleanPredicate();
50         Predicate *predicate;
51         FunctionEncoding encoding;
52         Array<Element *> inputs;
53         Boolean *undefStatus;
54         FunctionEncoding * getFunctionEncoding() {return &encoding;}
55         MEMALLOC;
56 };
57
58 class BooleanLogic : public Boolean {
59  public:
60         BooleanLogic(CSolver *solver, LogicOp _op, Boolean **array, uint asize);
61         LogicOp op;
62         Array<Boolean *> inputs;
63         MEMALLOC;
64 };
65 #endif