#endif /* ! __WIN32__ */
}
-CommandExecutor::CommandExecutor(Options& options)
+CommandExecutor::CommandExecutor(const Options& options)
: d_solver(new api::Solver(&options)),
d_symman(new SymbolManager(d_solver.get())),
- d_options(options),
+ d_driverOptions(&options),
d_result()
{
}
void CommandExecutor::printStatistics(std::ostream& out) const
{
- if (d_options.base.statistics)
+ if (d_solver->getOptions().base.statistics)
{
getSmtEngine()->printStatistics(out);
}
void CommandExecutor::printStatisticsSafe(int fd) const
{
- if (d_options.base.statistics)
+ if (d_solver->getOptions().base.statistics)
{
getSmtEngine()->printStatisticsSafe(fd);
}
bool CommandExecutor::doCommand(Command* cmd)
{
- if (d_options.base.parseOnly)
+ if (d_solver->getOptions().base.parseOnly)
{
return true;
}
return status;
} else {
- if (d_options.base.verbosity > 2)
+ if (d_solver->getOptions().base.verbosity > 2)
{
- *d_options.base.out << "Invoking: " << *cmd << std::endl;
+ *d_solver->getOptions().base.out << "Invoking: " << *cmd << std::endl;
}
return doCommandSingleton(cmd);
void CommandExecutor::reset()
{
- printStatistics(*d_options.base.err);
+ printStatistics(*d_solver->getOptions().base.err);
/* We have to keep options passed via CL on reset. These options are stored
- * in CommandExecutor::d_options (populated and created in the driver), and
- * CommandExecutor::d_options only contains *these* options since the
- * NodeManager copies the options into a new options object before SmtEngine
- * configures additional options based on the given CL options.
- * We can thus safely reuse CommandExecutor::d_options here. */
- d_solver.reset(new api::Solver(&d_options));
+ * in CommandExecutor::d_driverOptions (populated and created in the driver),
+ * and CommandExecutor::d_driverOptions only contains *these* options since
+ * the SmtEngine copies them into its own options object before configuring
+ * additional options based on the given CL options.
+ * We can thus safely reuse CommandExecutor::d_driverOptions here.
+ */
+ d_solver.reset(new api::Solver(d_driverOptions));
}
bool CommandExecutor::doCommandSingleton(Command* cmd)
{
bool status = true;
- if (d_options.base.verbosity >= -1)
+ if (d_solver->getOptions().base.verbosity >= -1)
{
status = solverInvoke(
- d_solver.get(), d_symman.get(), cmd, d_options.base.out);
+ d_solver.get(), d_symman.get(), cmd, d_solver->getOptions().base.out);
}
else
{
d_result = res = q->getResult();
}
- if ((cs != nullptr || q != nullptr) && d_options.base.statisticsEveryQuery)
+ if ((cs != nullptr || q != nullptr)
+ && d_solver->getOptions().base.statisticsEveryQuery)
{
- getSmtEngine()->printStatisticsDiff(*d_options.base.err);
+ getSmtEngine()->printStatisticsDiff(*d_solver->getOptions().base.err);
}
bool isResultUnsat = res.isUnsat() || res.isEntailed();
// dump the model/proof/unsat core if option is set
if (status) {
std::vector<std::unique_ptr<Command> > getterCommands;
- if (d_options.driver.dumpModels
+ if (d_solver->getOptions().driver.dumpModels
&& (res.isSat()
|| (res.isSatUnknown()
&& res.getUnknownExplanation() == api::Result::INCOMPLETE)))
{
getterCommands.emplace_back(new GetModelCommand());
}
- if (d_options.driver.dumpProofs && isResultUnsat)
+ if (d_solver->getOptions().driver.dumpProofs && isResultUnsat)
{
getterCommands.emplace_back(new GetProofCommand());
}
- if (d_options.driver.dumpInstantiations
+ if (d_solver->getOptions().driver.dumpInstantiations
&& GetInstantiationsCommand::isEnabled(d_solver.get(), res))
{
getterCommands.emplace_back(new GetInstantiationsCommand());
}
- if ((d_options.driver.dumpUnsatCores || d_options.driver.dumpUnsatCoresFull) && isResultUnsat)
+ if ((d_solver->getOptions().driver.dumpUnsatCores
+ || d_solver->getOptions().driver.dumpUnsatCoresFull)
+ && isResultUnsat)
{
getterCommands.emplace_back(new GetUnsatCoreCommand());
}
if (!getterCommands.empty()) {
// set no time limit during dumping if applicable
- if (d_options.driver.forceNoLimitCpuWhileDump)
+ if (d_solver->getOptions().driver.forceNoLimitCpuWhileDump)
{
setNoLimitCPU();
}
}
void CommandExecutor::flushOutputStreams() {
- printStatistics(*d_options.base.err);
+ printStatistics(*d_solver->getOptions().base.err);
// make sure out and err streams are flushed too
- if (d_options.base.out != nullptr)
+ if (d_solver->getOptions().base.out != nullptr)
{
- *d_options.base.out << std::flush;
+ *d_solver->getOptions().base.out << std::flush;
}
- if (d_options.base.err != nullptr)
+ if (d_solver->getOptions().base.err != nullptr)
{
- *d_options.base.err << std::flush;
+ *d_solver->getOptions().base.err << std::flush;
}
}