return out << "unknown";
default:
- return out << "SetBenchmarkStatusCommand::[UNKNOWNSTATUS!]";
+ return out << "BenchmarkStatus::[UNKNOWNSTATUS!]";
}
}
default:
Unhandled(lang);
}
-
}/* Printer::makePrinter() */
+void Printer::toStream(std::ostream& out, const Result& r) const throw() {
+ if(r.getType() == Result::TYPE_SAT) {
+ switch(r.isSat()) {
+ case Result::UNSAT:
+ out << "unsat";
+ break;
+ case Result::SAT:
+ out << "sat";
+ break;
+ case Result::SAT_UNKNOWN:
+ out << "unknown";
+ if(r.whyUnknown() != Result::UNKNOWN_REASON) {
+ out << " (" << r.whyUnknown() << ")";
+ }
+ break;
+ }
+ } else {
+ switch(r.isValid()) {
+ case Result::INVALID:
+ out << "invalid";
+ break;
+ case Result::VALID:
+ out << "valid";
+ break;
+ case Result::VALIDITY_UNKNOWN:
+ out << "unknown";
+ if(r.whyUnknown() != Result::UNKNOWN_REASON) {
+ out << " (" << r.whyUnknown() << ")";
+ }
+ break;
+ }
+ }
+}/* Printer::toStream() */
+
}/* CVC4 namespace */
/** Write a CommandStatus out to a stream with this Printer. */
virtual void toStream(std::ostream& out, const CommandStatus* s) const throw() = 0;
+ /**
+ * Write a Result out to a stream with this Printer.
+ *
+ * The default implementation writes a reasonable string in lowercase
+ * for sat, unsat, valid, invalid, or unknown results. This behavior
+ * is overridable by each Printer, since sometimes an output language
+ * has a particular preference for how results should appear.
+ */
+ virtual void toStream(std::ostream& out, const Result& r) const throw();
+
};/* class Printer */
}/* CVC4 namespace */
#include "util/result.h"
#include "util/Assert.h"
+#include "printer/printer.h"
using namespace std;
}
ostream& operator<<(ostream& out, const Result& r) {
- if(r.d_which == Result::TYPE_SAT) {
- switch(r.d_sat) {
- case Result::UNSAT:
- out << "unsat";
- break;
- case Result::SAT:
- out << "sat";
- break;
- case Result::SAT_UNKNOWN:
- out << "unknown";
- if(r.whyUnknown() != Result::UNKNOWN_REASON) {
- out << " (" << r.whyUnknown() << ")";
- }
- break;
- }
- } else {
- switch(r.d_validity) {
- case Result::INVALID:
- out << "invalid";
- break;
- case Result::VALID:
- out << "valid";
- break;
- case Result::VALIDITY_UNKNOWN:
- out << "unknown";
- if(r.whyUnknown() != Result::UNKNOWN_REASON) {
- out << " (" << r.whyUnknown() << ")";
- }
- break;
- }
- }
-
+ Printer::getPrinter(Node::setlanguage::getLanguage(out))->toStream(out, r);
return out;
}/* operator<<(ostream&, const Result&) */
VALIDITY_UNKNOWN = 2
};
+ enum Type {
+ TYPE_SAT,
+ TYPE_VALIDITY,
+ TYPE_NONE
+ };
+
enum UnknownExplanation {
REQUIRES_FULL_CHECK,
INCOMPLETE,
private:
enum Sat d_sat;
enum Validity d_validity;
- enum { TYPE_SAT, TYPE_VALIDITY, TYPE_NONE } d_which;
+ enum Type d_which;
enum UnknownExplanation d_unknownExplanation;
- friend std::ostream& CVC4::operator<<(std::ostream& out, const Result& r);
-
public:
Result() :
d_sat(SAT_UNKNOWN),
bool isUnknown() const {
return isSat() == SAT_UNKNOWN && isValid() == VALIDITY_UNKNOWN;
}
+ Type getType() const {
+ return d_which;
+ }
bool isNull() const {
return d_which == TYPE_NONE;
}