blob: aca61878d18830045bd302c5e919c319cc423292 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#include "cvc4_private.h"
#ifndef __CVC4__THEORY__ARITH__ARITHVAR_NODE_MAP_H
#define __CVC4__THEORY__ARITH__ARITHVAR_NODE_MAP_H
#include "theory/arith/arith_utilities.h"
#include "context/context.h"
#include "context/cdlist.h"
#include "context/cdmap.h"
#include "context/cdo.h"
namespace CVC4 {
namespace theory {
namespace arith {
class ArithVarNodeMap {
private:
/**
* Bidirectional map between Nodes and ArithVars.
*/
NodeToArithVarMap d_nodeToArithVarMap;
ArithVarToNodeMap d_arithVarToNodeMap;
public:
ArithVarNodeMap() {}
inline bool hasArithVar(TNode x) const {
return d_nodeToArithVarMap.find(x) != d_nodeToArithVarMap.end();
}
inline ArithVar asArithVar(TNode x) const{
Assert(hasArithVar(x));
Assert((d_nodeToArithVarMap.find(x))->second <= ARITHVAR_SENTINEL);
return (d_nodeToArithVarMap.find(x))->second;
}
inline Node asNode(ArithVar a) const{
Assert(d_arithVarToNodeMap.find(a) != d_arithVarToNodeMap.end());
return (d_arithVarToNodeMap.find(a))->second;
}
inline void setArithVar(TNode x, ArithVar a){
Assert(!hasArithVar(x));
Assert(d_arithVarToNodeMap.find(a) == d_arithVarToNodeMap.end());
d_arithVarToNodeMap[a] = x;
d_nodeToArithVarMap[x] = a;
}
const ArithVarToNodeMap& getArithVarToNodeMap() const {
return d_arithVarToNodeMap;
}
};/* class ArithVarNodeMap */
}/* CVC4::theory::arith namespace */
}/* CVC4::theory namespace */
}/* CVC4 namespace */
#endif /* __CVC4__THEORY__ARITH__ARITHVAR_NODE_MAP_H */
|