1 /********************* */
4 ** Top contributors (to current version):
5 ** Morgan Deters, Tim King, Paul Meng
6 ** This file is part of the CVC4 project.
7 ** Copyright (c) 2009-2017 by the authors listed in the file AUTHORS
8 ** in the top-level source directory) and their institutional affiliations.
9 ** All rights reserved. See the file COPYING in the top-level source
10 ** directory for licensing information.\endverbatim
12 ** \brief Base of the pretty-printer interface
14 ** Base of the pretty-printer interface.
17 #include "cvc4_private.h"
19 #ifndef __CVC4__PRINTER__PRINTER_H
20 #define __CVC4__PRINTER__PRINTER_H
25 #include "expr/node.h"
26 #include "options/language.h"
27 #include "smt/command.h"
28 #include "smt/model.h"
29 #include "util/sexpr.h"
34 /** Printers for each OutputLanguage */
35 static Printer
* d_printers
[language::output::LANG_MAX
];
37 /** Make a Printer for a given OutputLanguage */
38 static Printer
* makePrinter(OutputLanguage lang
) throw();
40 // disallow copy, assignment
41 Printer(const Printer
&) CVC4_UNDEFINED
;
42 Printer
& operator=(const Printer
&) CVC4_UNDEFINED
;
45 // derived classes can construct, but no one else.
49 /** write model response to command */
50 virtual void toStream(std::ostream
& out
, const Model
& m
, const Command
* c
) const throw() = 0;
52 /** write model response to command using another language printer */
53 void toStreamUsing(OutputLanguage lang
, std::ostream
& out
, const Model
& m
, const Command
* c
) const throw() {
54 getPrinter(lang
)->toStream(out
, m
, c
);
58 /** Get the Printer for a given OutputLanguage */
59 static Printer
* getPrinter(OutputLanguage lang
) throw();
61 /** Write a Node out to a stream with this Printer. */
62 virtual void toStream(std::ostream
& out
, TNode n
,
63 int toDepth
, bool types
, size_t dag
) const throw() = 0;
65 /** Write a Command out to a stream with this Printer. */
66 virtual void toStream(std::ostream
& out
, const Command
* c
,
67 int toDepth
, bool types
, size_t dag
) const throw() = 0;
69 /** Write a CommandStatus out to a stream with this Printer. */
70 virtual void toStream(std::ostream
& out
, const CommandStatus
* s
) const throw() = 0;
72 /** Write a Model out to a stream with this Printer. */
73 virtual void toStream(std::ostream
& out
, const Model
& m
) const throw();
75 /** Write an UnsatCore out to a stream with this Printer. */
76 virtual void toStream(std::ostream
& out
, const UnsatCore
& core
) const throw();
79 * Write the term that sygus datatype term n
80 * encodes to a stream with this Printer.
81 * For example, consider the datatype term
82 * (C_plus (C_minus C_x C_0) C_y)
83 * where C_plus, C_minus, C_x, C_0, C_y are constructors
84 * whose sygus operators are PLUS, MINUS, x, 0, y.
85 * In this case, this method is equivalent to printing
87 * (PLUS (MINUS x 0) y)
88 * This method may make calls to sygus printing callback
89 * methods stored in sygus datatype constructors.
91 virtual void toStreamSygus(std::ostream
& out
, TNode n
) const throw();
97 #endif /* __CVC4__PRINTER__PRINTER_H */