diff options
author | Andrew Reynolds <andrew.j.reynolds@gmail.com> | 2020-10-16 13:32:42 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-16 13:32:42 -0500 |
commit | 7c249b3efdeeb51fd3dfc2571bc529c55880cf5c (patch) | |
tree | 220a1c3f2aa53b047c2a52260fce3bd2dce22429 /src/printer/cvc/cvc_printer.cpp | |
parent | 547df7cd146091674562dfa4812f10bae7765934 (diff) |
Refactor SMT-level model object (#5277)
This refactors the SMT-level model object so that it is a wrapper around TheoryModel instead of a base class. This inheritance was unnecessary.
Moreover, it removes the virtual base models of the SMT-level model which were based on Expr. Now the interface is more minimal and in terms of Node only.
This PR further simplifies a few places in the code that interface with the SmtEngine with things related to models.
Diffstat (limited to 'src/printer/cvc/cvc_printer.cpp')
-rw-r--r-- | src/printer/cvc/cvc_printer.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/printer/cvc/cvc_printer.cpp b/src/printer/cvc/cvc_printer.cpp index 7fd26e1a0..bab619dce 100644 --- a/src/printer/cvc/cvc_printer.cpp +++ b/src/printer/cvc/cvc_printer.cpp @@ -1142,7 +1142,9 @@ void DeclareFunctionNodeCommandToStream( { out << tn; } - Node val = model.getSmtEngine()->getValue(n); + // We get the value from the theory model directly, which notice + // does not have to go through the standard SmtEngine::getValue interface. + Node val = model.getValue(n); if (options::modelUninterpDtEnum() && val.getKind() == kind::STORE) { TypeNode type_node = val[1].getType(); @@ -1162,11 +1164,12 @@ void DeclareFunctionNodeCommandToStream( } // namespace -void CvcPrinter::toStream(std::ostream& out, const Model& m) const +void CvcPrinter::toStream(std::ostream& out, const smt::Model& m) const { + const theory::TheoryModel* tm = m.getTheoryModel(); // print the model comments std::stringstream c; - m.getComments(c); + tm->getComments(c); std::string ln; while (std::getline(c, ln)) { @@ -1180,10 +1183,10 @@ void CvcPrinter::toStream(std::ostream& out, const Model& m) const } void CvcPrinter::toStream(std::ostream& out, - const Model& model, + const smt::Model& model, const NodeCommand* command) const { - const auto* theory_model = dynamic_cast<const theory::TheoryModel*>(&model); + const auto* theory_model = model.getTheoryModel(); AlwaysAssert(theory_model != nullptr); if (const auto* declare_type_command = dynamic_cast<const DeclareTypeNodeCommand*>(command)) |