1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Andrew Reynolds |
4 |
|
* |
5 |
|
* This file is part of the cvc5 project. |
6 |
|
* |
7 |
|
* Copyright (c) 2009-2021 by the authors listed in the file AUTHORS |
8 |
|
* in the top-level source directory and their institutional affiliations. |
9 |
|
* All rights reserved. See the file COPYING in the top-level source |
10 |
|
* directory for licensing information. |
11 |
|
* **************************************************************************** |
12 |
|
* |
13 |
|
* Bound variable manager. |
14 |
|
*/ |
15 |
|
|
16 |
|
#include "expr/bound_var_manager.h" |
17 |
|
|
18 |
|
#include "expr/node_manager_attributes.h" |
19 |
|
#include "util/rational.h" |
20 |
|
|
21 |
|
namespace cvc5 { |
22 |
|
|
23 |
10651 |
BoundVarManager::BoundVarManager() : d_keepCacheVals(false) {} |
24 |
|
|
25 |
8009 |
BoundVarManager::~BoundVarManager() {} |
26 |
|
|
27 |
3783 |
void BoundVarManager::enableKeepCacheValues(bool isEnabled) |
28 |
|
{ |
29 |
3783 |
d_keepCacheVals = isEnabled; |
30 |
3783 |
} |
31 |
|
|
32 |
|
void BoundVarManager::setNameAttr(Node v, const std::string& name) |
33 |
|
{ |
34 |
|
v.setAttribute(expr::VarNameAttr(), name); |
35 |
|
} |
36 |
|
|
37 |
|
Node BoundVarManager::getCacheValue(TNode cv1, TNode cv2) |
38 |
|
{ |
39 |
|
return NodeManager::currentNM()->mkNode(kind::SEXPR, cv1, cv2); |
40 |
|
} |
41 |
1838 |
Node BoundVarManager::getCacheValue(TNode cv1, TNode cv2, TNode cv3) |
42 |
|
{ |
43 |
1838 |
return NodeManager::currentNM()->mkNode(kind::SEXPR, cv1, cv2, cv3); |
44 |
|
} |
45 |
|
|
46 |
5461 |
Node BoundVarManager::getCacheValue(TNode cv1, TNode cv2, size_t i) |
47 |
|
{ |
48 |
|
return NodeManager::currentNM()->mkNode( |
49 |
5461 |
kind::SEXPR, cv1, cv2, getCacheValue(i)); |
50 |
|
} |
51 |
|
|
52 |
5461 |
Node BoundVarManager::getCacheValue(size_t i) |
53 |
|
{ |
54 |
5461 |
return NodeManager::currentNM()->mkConst(Rational(i)); |
55 |
|
} |
56 |
|
|
57 |
|
Node BoundVarManager::getCacheValue(TNode cv, size_t i) |
58 |
|
{ |
59 |
|
return getCacheValue(cv, getCacheValue(i)); |
60 |
|
} |
61 |
|
|
62 |
29517 |
} // namespace cvc5 |