summaryrefslogtreecommitdiff
path: root/src/main/command_executor.cpp
diff options
context:
space:
mode:
authorAina Niemetz <aina.niemetz@gmail.com>2018-08-08 19:21:47 -0700
committerGitHub <noreply@github.com>2018-08-08 19:21:47 -0700
commit91d85704313de6be9fd382833f5cedd39e24a6fa (patch)
tree057adfdad9d586428482d9bd58e9c8124bddc47b /src/main/command_executor.cpp
parentb4d4006d08a32b107257b0edaba95679d0b0c65b (diff)
Plug solver API object into parser. (#2240)
Diffstat (limited to 'src/main/command_executor.cpp')
-rw-r--r--src/main/command_executor.cpp35
1 files changed, 25 insertions, 10 deletions
diff --git a/src/main/command_executor.cpp b/src/main/command_executor.cpp
index 0fd421b24..40c31de99 100644
--- a/src/main/command_executor.cpp
+++ b/src/main/command_executor.cpp
@@ -24,6 +24,7 @@
#include <string>
#include <vector>
+#include "api/cvc4cpp.h"
#include "main/main.h"
#include "smt/command.h"
@@ -48,15 +49,29 @@ void setNoLimitCPU() {
void printStatsIncremental(std::ostream& out, const std::string& prvsStatsString, const std::string& curStatsString);
-CommandExecutor::CommandExecutor(ExprManager &exprMgr, Options &options) :
- d_exprMgr(exprMgr),
- d_smtEngine(new SmtEngine(&exprMgr)),
- d_options(options),
- d_stats("driver"),
- d_result(),
- d_replayStream(NULL)
+CommandExecutor::CommandExecutor(api::Solver* solver, Options& options)
+ : d_solver(solver),
+ d_smtEngine(d_solver->getSmtEngine()),
+ d_options(options),
+ d_stats("driver"),
+ d_result(),
+ d_replayStream(NULL)
{}
+void CommandExecutor::flushStatistics(std::ostream& out) const
+{
+ d_solver->getExprManager()->getStatistics().flushInformation(out);
+ d_smtEngine->getStatistics().flushInformation(out);
+ d_stats.flushInformation(out);
+}
+
+void CommandExecutor::safeFlushStatistics(int fd) const
+{
+ d_solver->getExprManager()->safeFlushStatistics(fd);
+ d_smtEngine->safeFlushStatistics(fd);
+ d_stats.safeFlushInformation(fd);
+}
+
void CommandExecutor::setReplayStream(ExprStream* replayStream) {
assert(d_replayStream == NULL);
d_replayStream = replayStream;
@@ -92,11 +107,11 @@ bool CommandExecutor::doCommand(Command* cmd)
void CommandExecutor::reset()
{
- if(d_options.getStatistics()) {
+ if (d_options.getStatistics())
+ {
flushStatistics(*d_options.getErr());
}
- delete d_smtEngine;
- d_smtEngine = new SmtEngine(&d_exprMgr);
+ d_solver->reset();
}
bool CommandExecutor::doCommandSingleton(Command* cmd)
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback