Switch to vector class
[satune.git] / src / AST / boolean.cc
index 08af722b1c2e406f1559450b6aca3f7b5cedaaec..3e05452019f17d6a576e68a610889ed2b81f4187 100644 (file)
@@ -4,15 +4,25 @@
 #include "element.h"
 #include "order.h"
 
-Boolean::Boolean(ASTNodeType _type) : ASTNode(_type), polarity(P_UNDEFINED), boolVal(BV_UNDEFINED) {
-       initDefVectorBoolean(GETBOOLEANPARENTS(this));  
+Boolean::Boolean(ASTNodeType _type) :
+       ASTNode(_type),
+       polarity(P_UNDEFINED),
+       boolVal(BV_UNDEFINED),
+       parents() {
 }
 
-BooleanVar::BooleanVar(VarType t) : Boolean(BOOLEANVAR), vtype(t), var(E_NULL) {
+BooleanVar::BooleanVar(VarType t) :
+       Boolean(BOOLEANVAR),
+       vtype(t),
+       var(E_NULL) {
 }
 
-BooleanOrder::BooleanOrder(Order *_order, uint64_t _first, uint64_t _second) : Boolean(ORDERCONST), order(_order), first(_first), second(_second) {
-       pushVectorBooleanOrder(&order->constraints, this);
+BooleanOrder::BooleanOrder(Order *_order, uint64_t _first, uint64_t _second) :
+       Boolean(ORDERCONST),
+       order(_order),
+       first(_first),
+       second(_second) {
+       order->constraints.push(this);
 }
 
 BooleanPredicate::BooleanPredicate(Predicate *_predicate, Element **_inputs, uint _numInputs, Boolean *_undefinedStatus) :
@@ -21,7 +31,7 @@ BooleanPredicate::BooleanPredicate(Predicate *_predicate, Element **_inputs, uin
        inputs(_inputs, _numInputs),
        undefStatus(_undefinedStatus) {
        for (uint i = 0; i < _numInputs; i++) {
-               pushVectorASTNode(GETELEMENTPARENTS(_inputs[i]), this);
+               GETELEMENTPARENTS(_inputs[i])->push(this);
        }
        initPredicateEncoding(&encoding, this);
 }
@@ -30,11 +40,7 @@ BooleanLogic::BooleanLogic(CSolver *solver, LogicOp _op, Boolean **array, uint a
        Boolean(LOGICOP),
        op(_op),
        inputs(array, asize) {
-       pushVectorBoolean(solver->allBooleans, (Boolean *) this);
-}
-
-Boolean::~Boolean() {
-       deleteVectorArrayBoolean(GETBOOLEANPARENTS(this));
+       solver->allBooleans.push(this);
 }
 
 BooleanPredicate::~BooleanPredicate() {