1 /********************* */
4 ** Original author: mdeters
5 ** Major contributors: none
6 ** Minor contributors (to current version): none
7 ** This file is part of the CVC4 prototype.
8 ** Copyright (c) 2009, 2010, 2011 The Analysis of Computer Systems Group (ACSys)
9 ** Courant Institute of Mathematical Sciences
10 ** New York University
11 ** See the file COPYING in the top-level source directory for licensing
12 ** information.\endverbatim
14 ** \brief Base of the pretty-printer interface
16 ** Base of the pretty-printer interface.
19 #include "cvc4_private.h"
21 #ifndef __CVC4__PRINTER__PRINTER_H
22 #define __CVC4__PRINTER__PRINTER_H
24 #include "util/language.h"
25 #include "util/sexpr.h"
26 #include "util/model.h"
27 #include "expr/node.h"
28 #include "expr/command.h"
33 /** Printers for each OutputLanguage */
34 static Printer
* d_printers
[language::output::LANG_MAX
];
36 /** Make a Printer for a given OutputLanguage */
37 static Printer
* makePrinter(OutputLanguage lang
) throw();
39 // disallow copy, assignment
40 Printer(const Printer
&) CVC4_UNUSED
;
41 Printer
& operator=(const Printer
&) CVC4_UNUSED
;
44 // derived classes can construct, but no one else.
48 /** Get the Printer for a given OutputLanguage */
49 static Printer
* getPrinter(OutputLanguage lang
) throw() {
50 if(d_printers
[lang
] == NULL
) {
51 d_printers
[lang
] = makePrinter(lang
);
53 return d_printers
[lang
];
56 /** Write a Node out to a stream with this Printer. */
57 virtual void toStream(std::ostream
& out
, TNode n
,
58 int toDepth
, bool types
, size_t dag
) const throw() = 0;
60 /** Write a Command out to a stream with this Printer. */
61 virtual void toStream(std::ostream
& out
, const Command
* c
,
62 int toDepth
, bool types
, size_t dag
) const throw() = 0;
64 /** Write a CommandStatus out to a stream with this Printer. */
65 virtual void toStream(std::ostream
& out
, const CommandStatus
* s
) const throw() = 0;
67 /** Write an SExpr out to a stream with this Printer. */
68 virtual void toStream(std::ostream
& out
, const SExpr
& sexpr
) const throw();
71 * Write a Result out to a stream with this Printer.
73 * The default implementation writes a reasonable string in lowercase
74 * for sat, unsat, valid, invalid, or unknown results. This behavior
75 * is overridable by each Printer, since sometimes an output language
76 * has a particular preference for how results should appear.
78 virtual void toStream(std::ostream
& out
, const Result
& r
) const throw();
80 /** Write a Model out to a stream with this Printer. */
81 virtual void toStream(std::ostream
& out
, Model
* m
) const throw();
85 /** write model response to command */
86 virtual void toStream(std::ostream
& out
, Model
* m
, Command
* c
, int c_type
) const throw() = 0;
91 #endif /* __CVC4__PRINTER__PRINTER_H */