}/* AstPrinter::toStream(CommandStatus*) */
-void AstPrinter::toStream(std::ostream& out, Model& m) const throw() {
+void AstPrinter::toStream(std::ostream& out, const Model& m) const throw() {
out << "Model()";
}
-void AstPrinter::toStream(std::ostream& out, Model& m, const Command* c) const throw() {
+void AstPrinter::toStream(std::ostream& out, const Model& m, const Command* c) const throw() {
// shouldn't be called; only the non-Command* version above should be
Unreachable();
}
class AstPrinter : public CVC4::Printer {
void toStream(std::ostream& out, TNode n, int toDepth, bool types) const throw();
- void toStream(std::ostream& out, Model& m, const Command* c) const throw();
+ void toStream(std::ostream& out, const Model& m, const Command* c) const throw();
public:
using CVC4::Printer::toStream;
void toStream(std::ostream& out, TNode n, int toDepth, bool types, size_t dag) const throw();
void toStream(std::ostream& out, const Command* c, int toDepth, bool types, size_t dag) const throw();
void toStream(std::ostream& out, const CommandStatus* s) const throw();
- void toStream(std::ostream& out, Model& m) const throw();
+ void toStream(std::ostream& out, const Model& m) const throw();
};/* class AstPrinter */
}/* CVC4::printer::ast namespace */
}/* CvcPrinter::toStream(CommandStatus*) */
-void CvcPrinter::toStream(std::ostream& out, Model& m, const Command* c) const throw() {
- theory::TheoryModel& tm = (theory::TheoryModel&) m;
+void CvcPrinter::toStream(std::ostream& out, const Model& m, const Command* c) const throw() {
+ const theory::TheoryModel& tm = (const theory::TheoryModel&) m;
if(dynamic_cast<const DeclareTypeCommand*>(c) != NULL) {
TypeNode tn = TypeNode::fromType( ((const DeclareTypeCommand*)c)->getType() );
if( options::modelUninterpDtEnum() && tn.isSort() &&
class CvcPrinter : public CVC4::Printer {
void toStream(std::ostream& out, TNode n, int toDepth, bool types, bool bracket) const throw();
- void toStream(std::ostream& out, Model& m, const Command* c) const throw();
+ void toStream(std::ostream& out, const Model& m, const Command* c) const throw();
public:
using CVC4::Printer::toStream;
void toStream(std::ostream& out, TNode n, int toDepth, bool types, size_t dag) const throw();
}
}/* Printer::toStream(SExpr) */
-void Printer::toStream(std::ostream& out, Model& m) const throw() {
+void Printer::toStream(std::ostream& out, const Model& m) const throw() {
for(size_t i = 0; i < m.getNumCommands(); ++i) {
toStream(out, m, m.getCommand(i));
}
Printer() throw() {}
/** write model response to command */
- virtual void toStream(std::ostream& out, Model& m, const Command* c) const throw() = 0;
+ virtual void toStream(std::ostream& out, const Model& m, const Command* c) const throw() = 0;
public:
/** Get the Printer for a given OutputLanguage */
virtual void toStream(std::ostream& out, const Result& r) const throw();
/** Write a Model out to a stream with this Printer. */
- virtual void toStream(std::ostream& out, Model& m) const throw();
+ virtual void toStream(std::ostream& out, const Model& m) const throw();
};/* class Printer */
Printer::getPrinter(language::output::LANG_SMTLIB_V2)->toStream(out, sexpr);
}/* Smt1Printer::toStream() */
-void Smt1Printer::toStream(std::ostream& out, Model& m) const throw() {
+void Smt1Printer::toStream(std::ostream& out, const Model& m) const throw() {
Printer::getPrinter(language::output::LANG_SMTLIB_V2)->toStream(out, m);
}
-void Smt1Printer::toStream(std::ostream& out, Model& m, const Command* c) const throw() {
+void Smt1Printer::toStream(std::ostream& out, const Model& m, const Command* c) const throw() {
// shouldn't be called; only the non-Command* version above should be
Unreachable();
}
namespace smt1 {
class Smt1Printer : public CVC4::Printer {
- void toStream(std::ostream& out, Model& m, const Command* c) const throw();
+ void toStream(std::ostream& out, const Model& m, const Command* c) const throw();
public:
using CVC4::Printer::toStream;
void toStream(std::ostream& out, TNode n, int toDepth, bool types, size_t dag) const throw();
void toStream(std::ostream& out, const Command* c, int toDepth, bool types, size_t dag) const throw();
void toStream(std::ostream& out, const CommandStatus* s) const throw();
void toStream(std::ostream& out, const SExpr& sexpr) const throw();
- void toStream(std::ostream& out, Model& m) const throw();
+ void toStream(std::ostream& out, const Model& m) const throw();
};/* class Smt1Printer */
}/* CVC4::printer::smt1 namespace */
}/* Smt2Printer::toStream(CommandStatus*) */
-void Smt2Printer::toStream(std::ostream& out, Model& m) const throw() {
+void Smt2Printer::toStream(std::ostream& out, const Model& m) const throw() {
out << "(model" << std::endl;
this->Printer::toStream(out, m);
out << ")" << std::endl;
}
-void Smt2Printer::toStream(std::ostream& out, Model& m, const Command* c) const throw() {
- theory::TheoryModel& tm = (theory::TheoryModel&) m;
+void Smt2Printer::toStream(std::ostream& out, const Model& m, const Command* c) const throw() {
+ const theory::TheoryModel& tm = (const theory::TheoryModel&) m;
if(dynamic_cast<const DeclareTypeCommand*>(c) != NULL) {
TypeNode tn = TypeNode::fromType( ((const DeclareTypeCommand*)c)->getType() );
if( options::modelUninterpDtEnum() && tn.isSort() &&
class Smt2Printer : public CVC4::Printer {
void toStream(std::ostream& out, TNode n, int toDepth, bool types) const throw();
- void toStream(std::ostream& out, Model& m, const Command* c) const throw();
- void toStream(std::ostream& out, Model& m) const throw();
+ void toStream(std::ostream& out, const Model& m, const Command* c) const throw();
+ void toStream(std::ostream& out, const Model& m) const throw();
public:
using CVC4::Printer::toStream;
void toStream(std::ostream& out, TNode n, int toDepth, bool types, size_t dag) const throw();
return quickCheck().asValidityResult();
}
-Node SmtEngine::postprocess(TNode node, TypeNode expectedType) {
+Node SmtEngine::postprocess(TNode node, TypeNode expectedType) const {
ModelPostprocessor mpost;
NodeVisitor<ModelPostprocessor> visitor;
Node value = visitor.run(mpost, node);
return n.toExpr();
}
-Expr SmtEngine::getValue(const Expr& ex) throw(ModalException, TypeCheckingException, LogicException) {
+Expr SmtEngine::getValue(const Expr& ex) const throw(ModalException, TypeCheckingException, LogicException) {
Assert(ex.getExprManager() == d_exprManager);
SmtScope smts(this);
// Check individual theory assertions
d_theoryEngine->checkTheoryAssertionsWithModel();
- if(Notice.isOn()) {
- // This operator<< routine is non-const (i.e., takes a non-const Model&).
- // This confuses the Notice() output routines, so extract the ostream
- // from it and output it "manually." Should be fixed by making Model
- // accessors const.
- Notice.getStream() << *m;
- }
+ // Output the model
+ Notice() << *m;
// We have a "fake context" for the substitution map (we don't need it
// to be context-dependent)
* like turning datatypes back into tuples, length-1-bitvectors back
* into booleans, etc.
*/
- Node postprocess(TNode n, TypeNode expectedType);
+ Node postprocess(TNode n, TypeNode expectedType) const;
/**
* This is something of an "init" procedure, but is idempotent; call
* by a SAT or INVALID query). Only permitted if the SmtEngine is
* set to operate interactively and produce-models is on.
*/
- Expr getValue(const Expr& e) throw(ModalException, TypeCheckingException, LogicException);
+ Expr getValue(const Expr& e) const throw(ModalException, TypeCheckingException, LogicException);
/**
* Add a function to the set of expressions whose value is to be
namespace CVC4 {
-std::ostream& operator<<(std::ostream& out, Model& m) {
+std::ostream& operator<<(std::ostream& out, const Model& m) {
smt::SmtScope smts(&m.d_smt);
Expr::dag::Scope scope(out, false);
Printer::getPrinter(options::outputLanguage())->toStream(out, m);
class SmtEngine;
class Model;
-std::ostream& operator<<(std::ostream&, Model&);
+std::ostream& operator<<(std::ostream&, const Model&);
class Model {
- friend std::ostream& operator<<(std::ostream&, Model&);
+ friend std::ostream& operator<<(std::ostream&, const Model&);
protected:
/** The SmtEngine we're associated with */
const Command* getCommand(size_t i) const;
/** get the smt engine that this model is hooked up to */
SmtEngine* getSmtEngine() { return &d_smt; }
+ /** get the smt engine (as a pointer-to-const) that this model is hooked up to */
+ const SmtEngine* getSmtEngine() const { return &d_smt; }
public:
/** get value for expression */