GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/expr/bound_var_manager.cpp Lines: 12 19 63.2 %
Date: 2021-05-22 Branches: 10 34 29.4 %

Line Exec Source
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
7673
BoundVarManager::BoundVarManager() : d_keepCacheVals(false) {}
23
24
7673
BoundVarManager::~BoundVarManager() {}
25
26
3600
void BoundVarManager::enableKeepCacheValues(bool isEnabled)
27
{
28
3600
  d_keepCacheVals = isEnabled;
29
3600
}
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
4616
Node BoundVarManager::getCacheValue(TNode cv1, TNode cv2, size_t i)
46
{
47
  return NodeManager::currentNM()->mkNode(
48
4616
      kind::SEXPR, cv1, cv2, getCacheValue(i));
49
}
50
51
4616
Node BoundVarManager::getCacheValue(size_t i)
52
{
53
4616
  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
28194
}  // namespace cvc5