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), overflowstatus(_overflowstatus) {
17 initArrayInitElement(&inputs, array, numArrays);
18 for (uint i = 0; i < numArrays; i++)
19 pushVectorASTNode(GETELEMENTPARENTS(array[i]), this);
20 initFunctionEncoding(&functionencoding, this);
23 ElementConst::ElementConst(uint64_t _value, VarType _type) : Element(ELEMCONST), value(_value) {
24 uint64_t array[]={value};
25 set = new Set(_type, array, 1);
28 Set *getElementSet(Element *This) {
29 switch (GETELEMENTTYPE(This)) {
31 return ((ElementSet *)This)->set;
33 return ((ElementConst *)This)->set;
34 case ELEMFUNCRETURN: {
35 Function *func = ((ElementFunction *)This)->function;
36 switch (GETFUNCTIONTYPE(func)) {
38 return ((FunctionTable *)func)->table->range;
40 return ((FunctionOperator *)func)->range;
52 ElementFunction::~ElementFunction() {
53 deleteInlineArrayElement(&inputs);
54 deleteFunctionEncoding(&functionencoding);
57 ElementConst::~ElementConst() {
62 deleteElementEncoding(&encoding);
63 deleteVectorArrayASTNode(GETELEMENTPARENTS(this));