d_rewriter(new theory::Rewriter()),
d_dumpManager(new DumpManager(d_userContext.get())),
d_logic(),
- d_statisticsRegistry(nullptr),
- d_resourceManager(nullptr)
+ d_statisticsRegistry(std::make_unique<StatisticsRegistry>()),
+ d_resourceManager(std::make_unique<ResourceManager>(*d_statisticsRegistry, d_options))
{
}
}
}
-void Env::setStatisticsRegistry(StatisticsRegistry* statReg)
-{
- d_statisticsRegistry = statReg;
- // now initialize resource manager
- d_resourceManager.reset(new ResourceManager(*statReg, d_options));
-}
-
void Env::setProofNodeManager(ProofNodeManager* pnm)
{
d_proofNodeManager = pnm;
StatisticsRegistry* Env::getStatisticsRegistry()
{
- return d_statisticsRegistry;
+ return d_statisticsRegistry.get();
}
const Options& Env::getOptions() const { return d_options; }
#include "options/options.h"
#include "theory/logic_info.h"
#include "util/statistics.h"
+#include "util/statistics_registry.h"
namespace CVC4 {
*/
LogicInfo d_logic;
/**
- * The statistics registry, which is owned by the SmtEngine that owns this.
+ * The statistics registry owned by this Env.
*/
- StatisticsRegistry* d_statisticsRegistry;
+ std::unique_ptr<StatisticsRegistry> d_statisticsRegistry;
/**
* The options object, which contains the modified version of the options
* provided as input to the SmtEngine that owns this environment. Note
// Set options in the environment, which makes a deep copy of optr if
// non-null. This may throw an options exception.
d_env->setOptions(optr);
- // now construct the statistics registry
- d_statisticsRegistry.reset(new StatisticsRegistry());
- // initialize the environment, which keeps a pointer to statistics registry
- // and sets up resource manager
- d_env->setStatisticsRegistry(d_statisticsRegistry.get());
// set the options manager
d_optm.reset(new smt::OptionsManager(&getOptions(), getResourceManager()));
// listen to node manager events
d_routListener.reset(nullptr);
d_optm.reset(nullptr);
d_pp.reset(nullptr);
- d_statisticsRegistry.reset(nullptr);
// destroy the state
d_state.reset(nullptr);
// destroy the environment
v.push_back((*i).second);
stats.push_back(v);
}
- for (StatisticsRegistry::const_iterator i = d_statisticsRegistry->begin();
- i != d_statisticsRegistry->end();
+ for (StatisticsRegistry::const_iterator i = d_env->getStatisticsRegistry()->begin();
+ i != d_env->getStatisticsRegistry()->end();
++i)
{
vector<SExpr> v;
StatisticsRegistry* SmtEngine::getStatisticsRegistry()
{
- return d_statisticsRegistry.get();
+ return d_env->getStatisticsRegistry();
}
UnsatCore SmtEngine::getUnsatCoreInternal()
Statistics SmtEngine::getStatistics() const
{
- return Statistics(*d_statisticsRegistry);
+ return Statistics(*d_env->getStatisticsRegistry());
}
SExpr SmtEngine::getStatistic(std::string name) const
{
- return d_statisticsRegistry->getStatistic(name);
+ return d_env->getStatisticsRegistry()->getStatistic(name);
}
void SmtEngine::flushStatistics(std::ostream& out) const
{
getNodeManager()->getStatisticsRegistry()->flushInformation(out);
- d_statisticsRegistry->flushInformation(out);
+ d_env->getStatisticsRegistry()->flushInformation(out);
}
void SmtEngine::safeFlushStatistics(int fd) const
{
getNodeManager()->getStatisticsRegistry()->safeFlushInformation(fd);
- d_statisticsRegistry->safeFlushInformation(fd);
+ d_env->getStatisticsRegistry()->safeFlushInformation(fd);
}
void SmtEngine::setUserAttribute(const std::string& attr,
/** Solver instance that owns this SmtEngine instance. */
api::Solver* d_solver = nullptr;
- /**
- * The statistics registry. Notice that this definition must be before the
- * other members since it must be destroyed last if exceptions occur in the
- * constructor of SmtEngine.
- */
- std::unique_ptr<StatisticsRegistry> d_statisticsRegistry;
/**
* The environment object, which contains all utilities that are globally
* available to internal code.