GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/expr/bound_var_manager.cpp Lines: 12 19 63.2 %
Date: 2021-08-14 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
7966
BoundVarManager::BoundVarManager() : d_keepCacheVals(false) {}
24
25
7966
BoundVarManager::~BoundVarManager() {}
26
27
3768
void BoundVarManager::enableKeepCacheValues(bool isEnabled)
28
{
29
3768
  d_keepCacheVals = isEnabled;
30
3768
}
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
1703
Node BoundVarManager::getCacheValue(TNode cv1, TNode cv2, TNode cv3)
42
{
43
1703
  return NodeManager::currentNM()->mkNode(kind::SEXPR, cv1, cv2, cv3);
44
}
45
46
4567
Node BoundVarManager::getCacheValue(TNode cv1, TNode cv2, size_t i)
47
{
48
  return NodeManager::currentNM()->mkNode(
49
4567
      kind::SEXPR, cv1, cv2, getCacheValue(i));
50
}
51
52
4567
Node BoundVarManager::getCacheValue(size_t i)
53
{
54
4567
  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
29340
}  // namespace cvc5