1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
/******************************************************************************
* Top contributors (to current version):
* Andrew Reynolds, Gereon Kremer, Aina Niemetz
*
* This file is part of the cvc5 project.
*
* Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
* in the top-level source directory and their institutional affiliations.
* All rights reserved. See the file COPYING in the top-level source
* directory for licensing information.
* ****************************************************************************
*
* Smt Environment, main access to global utilities available to
* internal code.
*/
#include "smt/env.h"
#include "context/context.h"
#include "expr/node.h"
#include "options/base_options.h"
#include "printer/printer.h"
#include "proof/conv_proof_generator.h"
#include "smt/dump_manager.h"
#include "smt/smt_engine_stats.h"
#include "theory/rewriter.h"
#include "theory/trust_substitutions.h"
#include "util/resource_manager.h"
#include "util/statistics_registry.h"
using namespace cvc5::smt;
namespace cvc5 {
Env::Env(NodeManager* nm, Options* opts)
: d_context(new context::Context()),
d_userContext(new context::UserContext()),
d_nodeManager(nm),
d_proofNodeManager(nullptr),
d_rewriter(new theory::Rewriter()),
d_topLevelSubs(new theory::TrustSubstitutionMap(d_userContext.get())),
d_dumpManager(new DumpManager(d_userContext.get())),
d_logic(),
d_statisticsRegistry(std::make_unique<StatisticsRegistry>()),
d_options(),
d_originalOptions(opts),
d_resourceManager()
{
if (opts != nullptr)
{
d_options.copyValues(*opts);
}
d_resourceManager = std::make_unique<ResourceManager>(*d_statisticsRegistry, d_options);
}
Env::~Env() {}
void Env::setProofNodeManager(ProofNodeManager* pnm)
{
Assert(pnm != nullptr);
Assert(d_proofNodeManager == nullptr);
d_proofNodeManager = pnm;
d_rewriter->setProofNodeManager(pnm);
d_topLevelSubs->setProofNodeManager(pnm);
}
void Env::shutdown()
{
d_rewriter.reset(nullptr);
d_dumpManager.reset(nullptr);
// d_resourceManager must be destroyed before d_statisticsRegistry
d_resourceManager.reset(nullptr);
}
context::UserContext* Env::getUserContext() { return d_userContext.get(); }
context::Context* Env::getContext() { return d_context.get(); }
NodeManager* Env::getNodeManager() const { return d_nodeManager; }
ProofNodeManager* Env::getProofNodeManager() { return d_proofNodeManager; }
theory::Rewriter* Env::getRewriter() { return d_rewriter.get(); }
theory::TrustSubstitutionMap& Env::getTopLevelSubstitutions()
{
return *d_topLevelSubs.get();
}
DumpManager* Env::getDumpManager() { return d_dumpManager.get(); }
const LogicInfo& Env::getLogicInfo() const { return d_logic; }
StatisticsRegistry& Env::getStatisticsRegistry()
{
return *d_statisticsRegistry;
}
const Options& Env::getOptions() const { return d_options; }
const Options& Env::getOriginalOptions() const { return *d_originalOptions; }
ResourceManager* Env::getResourceManager() const
{
return d_resourceManager.get();
}
const Printer& Env::getPrinter()
{
return *Printer::getPrinter(d_options.base.outputLanguage);
}
std::ostream& Env::getDumpOut() { return *d_options.base.out; }
} // namespace cvc5
|