Allow access to the Output() macro via the API.
#include "options/option_exception.h"
#include "options/options.h"
#include "options/options_public.h"
+#include "options/outputc.h"
#include "options/smt_options.h"
#include "proof/unsat_core.h"
#include "smt/model.h"
return Statistics(d_smtEngine->getStatisticsRegistry());
}
+std::ostream& Solver::getOutput(const std::string& tag) const
+{
+ // `Output(tag)` may raise an `OptionException`, which we do not want to
+ // forward as such. We thus do not use the standard exception handling macros
+ // here but roll our own.
+ try
+ {
+ return Output(tag);
+ }
+ catch (const cvc5::Exception& e)
+ {
+ throw CVC5ApiException("Invalid output tag " + tag);
+ }
+}
+
} // namespace api
} // namespace cvc5
*/
Statistics getStatistics() const;
+ /**
+ * Returns an output stream for the given tag. Tags can be enabled with the
+ * `output` option (and `-o <tag>` on the command line). Raises an exception
+ * when an invalid tag is given.
+ */
+ std::ostream& getOutput(const std::string& tag) const;
+
private:
/** @return the node manager of this solver */
NodeManager* getNodeManager(void) const;
}
}
+Cvc5ostream OutputC::operator()(const std::string& tag) const
+{
+ return (*this)(options::stringToOutputTag(tag));
+}
+
bool OutputC::isOn(const options::OutputTag tag) const
{
return options::outputTagHolder()[static_cast<size_t>(tag)];
explicit OutputC(std::ostream* os) : d_os(os) {}
Cvc5ostream operator()(const options::OutputTag tag) const;
+ Cvc5ostream operator()(const std::string& tag) const;
bool isOn(const options::OutputTag tag) const;