GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/expr/bound_var_manager.cpp Lines: 12 19 63.2 %
Date: 2021-09-29 Branches: 10 32 31.3 %

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
#include "util/rational.h"
20
21
namespace cvc5 {
22
23
7582
BoundVarManager::BoundVarManager() : d_keepCacheVals(false) {}
24
25
7582
BoundVarManager::~BoundVarManager() {}
26
27
143
void BoundVarManager::enableKeepCacheValues(bool isEnabled)
28
{
29
143
  d_keepCacheVals = isEnabled;
30
143
}
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
593
Node BoundVarManager::getCacheValue(TNode cv1, TNode cv2, TNode cv3)
42
{
43
593
  return NodeManager::currentNM()->mkNode(kind::SEXPR, cv1, cv2, cv3);
44
}
45
46
2250
Node BoundVarManager::getCacheValue(TNode cv1, TNode cv2, size_t i)
47
{
48
  return NodeManager::currentNM()->mkNode(
49
2250
      kind::SEXPR, cv1, cv2, getCacheValue(i));
50
}
51
52
2250
Node BoundVarManager::getCacheValue(size_t i)
53
{
54
2250
  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
22746
}  // namespace cvc5