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 |
|
|
20 |
|
namespace cvc5 { |
21 |
|
|
22 |
7519 |
BoundVarManager::BoundVarManager() : d_keepCacheVals(false) {} |
23 |
|
|
24 |
7519 |
BoundVarManager::~BoundVarManager() {} |
25 |
|
|
26 |
3117 |
void BoundVarManager::enableKeepCacheValues(bool isEnabled) |
27 |
|
{ |
28 |
3117 |
d_keepCacheVals = isEnabled; |
29 |
3117 |
} |
30 |
|
|
31 |
|
void BoundVarManager::setNameAttr(Node v, const std::string& name) |
32 |
|
{ |
33 |
|
v.setAttribute(expr::VarNameAttr(), name); |
34 |
|
} |
35 |
|
|
36 |
|
Node BoundVarManager::getCacheValue(TNode cv1, TNode cv2) |
37 |
|
{ |
38 |
|
return NodeManager::currentNM()->mkNode(kind::SEXPR, cv1, cv2); |
39 |
|
} |
40 |
1722 |
Node BoundVarManager::getCacheValue(TNode cv1, TNode cv2, TNode cv3) |
41 |
|
{ |
42 |
1722 |
return NodeManager::currentNM()->mkNode(kind::SEXPR, cv1, cv2, cv3); |
43 |
|
} |
44 |
|
|
45 |
4609 |
Node BoundVarManager::getCacheValue(TNode cv1, TNode cv2, size_t i) |
46 |
|
{ |
47 |
|
return NodeManager::currentNM()->mkNode( |
48 |
4609 |
kind::SEXPR, cv1, cv2, getCacheValue(i)); |
49 |
|
} |
50 |
|
|
51 |
4609 |
Node BoundVarManager::getCacheValue(size_t i) |
52 |
|
{ |
53 |
4609 |
return NodeManager::currentNM()->mkConst(Rational(i)); |
54 |
|
} |
55 |
|
|
56 |
|
Node BoundVarManager::getCacheValue(TNode cv, size_t i) |
57 |
|
{ |
58 |
|
return getCacheValue(cv, getCacheValue(i)); |
59 |
|
} |
60 |
|
|
61 |
27735 |
} // namespace cvc5 |