4 #include "constraint.h"
8 Element::Element(ASTNodeType _type) : ASTNode(_type) {
9 initDefVectorASTNode(GETELEMENTPARENTS(this));
10 initElementEncoding(&encoding, (Element *) this);
13 ElementSet::ElementSet(Set *s) : Element(ELEMSET), set(s) {
16 ElementFunction::ElementFunction(Function *_function, Element **array, uint numArrays, Boolean *_overflowstatus) : Element(ELEMFUNCRETURN), function(_function), inputs(array, numArrays), overflowstatus(_overflowstatus) {
17 for (uint i = 0; i < numArrays; i++)
18 pushVectorASTNode(GETELEMENTPARENTS(array[i]), this);
19 initFunctionEncoding(&functionencoding, this);
22 ElementConst::ElementConst(uint64_t _value, VarType _type) : Element(ELEMCONST), value(_value) {
23 uint64_t array[]={value};
24 set = new Set(_type, array, 1);
27 Set *getElementSet(Element *This) {
28 switch (GETELEMENTTYPE(This)) {
30 return ((ElementSet *)This)->set;
32 return ((ElementConst *)This)->set;
33 case ELEMFUNCRETURN: {
34 Function *func = ((ElementFunction *)This)->function;
35 switch (GETFUNCTIONTYPE(func)) {
37 return ((FunctionTable *)func)->table->range;
39 return ((FunctionOperator *)func)->range;
51 ElementFunction::~ElementFunction() {
52 deleteFunctionEncoding(&functionencoding);
55 ElementConst::~ElementConst() {
60 deleteElementEncoding(&encoding);
61 deleteVectorArrayASTNode(GETELEMENTPARENTS(this));