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 "expr/node.h"
27 #include "expr/command.h"
32 /** Printers for each OutputLanguage */
33 static Printer
* d_printers
[language::output::LANG_MAX
];
35 /** Make a Printer for a given OutputLanguage */
36 static Printer
* makePrinter(OutputLanguage lang
) throw();
38 // disallow copy, assignment
39 Printer(const Printer
&) CVC4_UNUSED
;
40 Printer
& operator=(const Printer
&) CVC4_UNUSED
;
43 // derived classes can construct, but no one else.
47 /** Get the Printer for a given OutputLanguage */
48 static Printer
* getPrinter(OutputLanguage lang
) throw() {
49 if(d_printers
[lang
] == NULL
) {
50 d_printers
[lang
] = makePrinter(lang
);
52 return d_printers
[lang
];
55 /** Write a Node out to a stream with this Printer. */
56 virtual void toStream(std::ostream
& out
, TNode n
,
57 int toDepth
, bool types
, size_t dag
) const throw() = 0;
59 /** Write a Command out to a stream with this Printer. */
60 virtual void toStream(std::ostream
& out
, const Command
* c
,
61 int toDepth
, bool types
, size_t dag
) const throw() = 0;
63 /** Write a CommandStatus out to a stream with this Printer. */
64 virtual void toStream(std::ostream
& out
, const CommandStatus
* s
) const throw() = 0;
66 /** Write an SExpr out to a stream with this Printer. */
67 virtual void toStream(std::ostream
& out
, const SExpr
& sexpr
) const throw();
70 * Write a Result out to a stream with this Printer.
72 * The default implementation writes a reasonable string in lowercase
73 * for sat, unsat, valid, invalid, or unknown results. This behavior
74 * is overridable by each Printer, since sometimes an output language
75 * has a particular preference for how results should appear.
77 virtual void toStream(std::ostream
& out
, const Result
& r
) const throw();
83 #endif /* __CVC4__PRINTER__PRINTER_H */