EncodingContext's solver needs to be set dynamically

This commit is contained in:
Leonardo Alt
2019-07-08 14:40:15 +02:00
parent 035fde2932
commit 01570bbc8c
4 changed files with 20 additions and 8 deletions
+14 -2
View File
@@ -36,7 +36,7 @@ namespace smt
class EncodingContext
{
public:
EncodingContext(std::shared_ptr<SolverInterface> _solver);
EncodingContext();
/// Resets the entire context except for symbolic variables which stay
/// alive because of state variables and inlined function calls.
@@ -46,6 +46,14 @@ public:
/// To be used before a model checking engine starts.
void clear();
/// Sets the current solver used by the current engine for
/// SMT variable declaration.
void setSolver(std::shared_ptr<SolverInterface> _solver)
{
solAssert(_solver, "");
m_solver = _solver;
}
/// Forwards variable creation to the solver.
Expression newVariable(std::string _name, SortPointer _sort)
{
@@ -133,7 +141,11 @@ public:
void pushSolver();
void popSolver();
void addAssertion(Expression const& _e);
std::shared_ptr<SolverInterface> solver() { return m_solver; }
std::shared_ptr<SolverInterface> solver()
{
solAssert(m_solver, "");
return m_solver;
}
//@}
private: