diff options
author | Tim King <taking@cs.nyu.edu> | 2011-02-18 23:28:19 +0000 |
---|---|---|
committer | Tim King <taking@cs.nyu.edu> | 2011-02-18 23:28:19 +0000 |
commit | 005066130a774c9e4aa838ca500d5fd3137909be (patch) | |
tree | 00f30cf01943464435f9ae50ddfec53822617bd8 /src/theory/arith/arith_utilities.h | |
parent | b2eba85abe17f3cb661b537d4ac6c55c2e222c65 (diff) |
Changes:
- ArithVar is no longer an attribute
- RowVector's destructor reduces the row count of its variables upon.
- Tableau's destructor now free its rows instead of leaking memory.
- Added ability to convert ReducedRowVectors into equivalent Nodes.
- getValue() should work again.
Diffstat (limited to 'src/theory/arith/arith_utilities.h')
-rw-r--r-- | src/theory/arith/arith_utilities.h | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/theory/arith/arith_utilities.h b/src/theory/arith/arith_utilities.h index 6a9102a19..2053379d9 100644 --- a/src/theory/arith/arith_utilities.h +++ b/src/theory/arith/arith_utilities.h @@ -28,6 +28,7 @@ #include <vector> #include <stdint.h> #include <limits> +#include <ext/hash_map> namespace CVC4 { namespace theory { @@ -38,23 +39,10 @@ typedef uint32_t ArithVar; //static const ArithVar ARITHVAR_SENTINEL = std::numeric_limits<ArithVar>::max(); #define ARITHVAR_SENTINEL std::numeric_limits<ArithVar>::max() -struct ArithVarAttrID{}; -typedef expr::Attribute<ArithVarAttrID,uint64_t> ArithVarAttr; +//Maps from Nodes -> ArithVars, and vice versa +typedef __gnu_cxx::hash_map<Node, ArithVar, NodeHashFunction> NodeToArithVarMap; +typedef __gnu_cxx::hash_map<ArithVar, Node> ArithVarToNodeMap; -inline bool hasArithVar(TNode x){ - return x.hasAttribute(ArithVarAttr()); -} - -inline ArithVar asArithVar(TNode x){ - Assert(hasArithVar(x)); - Assert(x.getAttribute(ArithVarAttr()) <= ARITHVAR_SENTINEL); - return x.getAttribute(ArithVarAttr()); -} - -inline void setArithVar(TNode x, ArithVar a){ - Assert(!hasArithVar(x)); - return x.setAttribute(ArithVarAttr(), (uint64_t)a); -} inline Node mkRationalNode(const Rational& q){ return NodeManager::currentNM()->mkConst<Rational>(q); |