GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/smt/env.cpp Lines: 41 42 97.6 %
Date: 2021-05-21 Branches: 23 72 31.9 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Andrew Reynolds, Gereon Kremer, Aina Niemetz
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
 * Smt Environment, main access to global utilities available to
14
 * internal code.
15
 */
16
17
#include "smt/env.h"
18
19
#include "context/context.h"
20
#include "expr/node.h"
21
#include "expr/term_conversion_proof_generator.h"
22
#include "options/base_options.h"
23
#include "printer/printer.h"
24
#include "smt/dump_manager.h"
25
#include "smt/smt_engine_stats.h"
26
#include "theory/rewriter.h"
27
#include "theory/trust_substitutions.h"
28
#include "util/resource_manager.h"
29
#include "util/statistics_registry.h"
30
31
using namespace cvc5::smt;
32
33
namespace cvc5 {
34
35
9587
Env::Env(NodeManager* nm, Options* opts)
36
9587
    : d_context(new context::Context()),
37
9587
      d_userContext(new context::UserContext()),
38
      d_nodeManager(nm),
39
      d_proofNodeManager(nullptr),
40
9587
      d_rewriter(new theory::Rewriter()),
41
19174
      d_topLevelSubs(new theory::TrustSubstitutionMap(d_userContext.get())),
42
9587
      d_dumpManager(new DumpManager(d_userContext.get())),
43
      d_logic(),
44
      d_statisticsRegistry(std::make_unique<StatisticsRegistry>()),
45
      d_options(),
46
67109
      d_resourceManager()
47
{
48
9587
  if (opts != nullptr)
49
  {
50
8747
    d_options.copyValues(*opts);
51
  }
52
9587
  d_resourceManager = std::make_unique<ResourceManager>(*d_statisticsRegistry, d_options);
53
9587
}
54
55
9587
Env::~Env() {}
56
57
3117
void Env::setProofNodeManager(ProofNodeManager* pnm)
58
{
59
3117
  Assert(pnm != nullptr);
60
3117
  Assert(d_proofNodeManager == nullptr);
61
3117
  d_proofNodeManager = pnm;
62
3117
  d_rewriter->setProofNodeManager(pnm);
63
3117
  d_topLevelSubs->setProofNodeManager(pnm);
64
3117
}
65
66
9586
void Env::shutdown()
67
{
68
9586
  d_rewriter.reset(nullptr);
69
9586
  d_dumpManager.reset(nullptr);
70
  // d_resourceManager must be destroyed before d_statisticsRegistry
71
9586
  d_resourceManager.reset(nullptr);
72
9586
}
73
74
381740
context::UserContext* Env::getUserContext() { return d_userContext.get(); }
75
76
12245726
context::Context* Env::getContext() { return d_context.get(); }
77
78
1355444
NodeManager* Env::getNodeManager() const { return d_nodeManager; }
79
80
8954
ProofNodeManager* Env::getProofNodeManager() { return d_proofNodeManager; }
81
82
27236484
theory::Rewriter* Env::getRewriter() { return d_rewriter.get(); }
83
84
279383
theory::TrustSubstitutionMap& Env::getTopLevelSubstitutions()
85
{
86
279383
  return *d_topLevelSubs.get();
87
}
88
89
20839
DumpManager* Env::getDumpManager() { return d_dumpManager.get(); }
90
91
74293
const LogicInfo& Env::getLogicInfo() const { return d_logic; }
92
93
4388667
StatisticsRegistry& Env::getStatisticsRegistry()
94
{
95
4388667
  return *d_statisticsRegistry;
96
}
97
98
29
const Options& Env::getOptions() const { return d_options; }
99
100
35605548
ResourceManager* Env::getResourceManager() const
101
{
102
35605548
  return d_resourceManager.get();
103
}
104
105
10
const Printer& Env::getPrinter()
106
{
107
10
  return *Printer::getPrinter(d_options[options::outputLanguage]);
108
}
109
110
std::ostream& Env::getDumpOut() { return *d_options.getOut(); }
111
112
27735
}  // namespace cvc5