Pretty-printer infrastructure created (in src/printer) and SMT-LIBv2 printer
[cvc5.git] / src / printer / printer.h
1 /********************* */
2 /*! \file printer.h
3 ** \verbatim
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 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
13 **
14 ** \brief Base of the pretty-printer interface
15 **
16 ** Base of the pretty-printer interface.
17 **/
18
19 #include "cvc4_private.h"
20
21 #ifndef __CVC4__PRINTER__PRINTER_H
22 #define __CVC4__PRINTER__PRINTER_H
23
24 #include "util/language.h"
25 #include "expr/node.h"
26
27 namespace CVC4 {
28
29 class Printer {
30 /** Printers for each OutputLanguage */
31 static Printer* d_printers[language::output::LANG_MAX];
32
33 /** Make a Printer for a given OutputLanguage */
34 static Printer* makePrinter(OutputLanguage lang);
35
36 public:
37 /** Get the Printer for a given OutputLanguage */
38 static Printer* getPrinter(OutputLanguage lang) {
39 if(d_printers[lang] == NULL) {
40 d_printers[lang] = makePrinter(lang);
41 }
42 return d_printers[lang];
43 }
44
45 /** Write a Node out to a stream with this Printer. */
46 virtual std::ostream& toStream(std::ostream& out, TNode n,
47 int toDepth, bool types) const = 0;
48 };/* class Printer */
49
50 }/* CVC4 namespace */
51
52 #endif /* __CVC4__PRINTER__PRINTER_H */
53