1 /********************* */
2 /*! \file update_ostream.h
4 ** Original author: Tim King
5 ** Major contributors: none
6 ** Minor contributors (to current version): none
7 ** This file is part of the CVC4 project.
8 ** Copyright (c) 2009-2016 New York University and The University of Iowa
9 ** See the file COPYING in the top-level source directory for licensing
10 ** information.\endverbatim
12 ** \brief [[ Add one-line brief description here ]]
14 ** [[ Add lengthier description here ]]
15 ** \todo document this file
18 #include "cvc4_private.h"
20 #ifndef __CVC4__UPDATE_OSTREAM_H
21 #define __CVC4__UPDATE_OSTREAM_H
25 #include "base/cvc4_assert.h"
26 #include "base/output.h"
27 #include "expr/expr_iomanip.h"
28 #include "options/language.h"
29 #include "options/set_language.h"
30 #include "options/base_options.h"
31 #include "smt_util/dump.h"
35 class ChannelSettings
{
37 ChannelSettings(std::ostream
& out
)
38 : d_dagSetting(expr::ExprDag::getDag(out
)),
39 d_exprDepthSetting(expr::ExprSetDepth::getDepth(out
)),
40 d_printtypesSetting(expr::ExprPrintTypes::getPrintTypes(out
)),
41 d_languageSetting(language::SetLanguage::getLanguage(out
))
44 void apply(std::ostream
& out
) {
45 out
<< expr::ExprDag(d_dagSetting
);
46 out
<< expr::ExprSetDepth(d_exprDepthSetting
);
47 out
<< expr::ExprPrintTypes(d_printtypesSetting
);
48 out
<< language::SetLanguage(d_languageSetting
);
52 const int d_dagSetting
;
53 const size_t d_exprDepthSetting
;
54 const bool d_printtypesSetting
;
55 const OutputLanguage d_languageSetting
;
56 }; /* class ChannelSettings */
60 virtual ~OstreamUpdate(){}
62 virtual std::ostream
& get() = 0;
63 virtual void set(std::ostream
* setTo
) = 0;
65 void apply(std::ostream
* setTo
) {
66 PrettyCheckArgument(setTo
!= NULL
, setTo
);
68 ChannelSettings
initialSettings(get());
70 initialSettings
.apply(get());
72 }; /* class OstreamUpdate */
74 class OptionsErrOstreamUpdate
: public OstreamUpdate
{
76 virtual std::ostream
& get() { return *(options::err()); }
77 virtual void set(std::ostream
* setTo
) { return options::err
.set(setTo
); }
78 }; /* class OptionsErrOstreamUpdate */
80 class DumpOstreamUpdate
: public OstreamUpdate
{
82 virtual std::ostream
& get() { return Dump
.getStream(); }
83 virtual void set(std::ostream
* setTo
) { Dump
.setStream(setTo
); }
84 }; /* class DumpOstreamUpdate */
86 class DebugOstreamUpdate
: public OstreamUpdate
{
88 virtual std::ostream
& get() { return Debug
.getStream(); }
89 virtual void set(std::ostream
* setTo
) { Debug
.setStream(setTo
); }
90 }; /* class DebugOstreamUpdate */
92 class WarningOstreamUpdate
: public OstreamUpdate
{
94 virtual std::ostream
& get() { return Warning
.getStream(); }
95 virtual void set(std::ostream
* setTo
) { Warning
.setStream(setTo
); }
96 }; /* class WarningOstreamUpdate */
98 class MessageOstreamUpdate
: public OstreamUpdate
{
100 virtual std::ostream
& get() { return Message
.getStream(); }
101 virtual void set(std::ostream
* setTo
) { Message
.setStream(setTo
); }
102 }; /* class MessageOstreamUpdate */
104 class NoticeOstreamUpdate
: public OstreamUpdate
{
106 virtual std::ostream
& get() { return Notice
.getStream(); }
107 virtual void set(std::ostream
* setTo
) { Notice
.setStream(setTo
); }
108 }; /* class NoticeOstreamUpdate */
110 class ChatOstreamUpdate
: public OstreamUpdate
{
112 virtual std::ostream
& get() { return Chat
.getStream(); }
113 virtual void set(std::ostream
* setTo
) { Chat
.setStream(setTo
); }
114 }; /* class ChatOstreamUpdate */
116 class TraceOstreamUpdate
: public OstreamUpdate
{
118 virtual std::ostream
& get() { return Trace
.getStream(); }
119 virtual void set(std::ostream
* setTo
) { Trace
.setStream(setTo
); }
120 }; /* class TraceOstreamUpdate */
122 }/* CVC4 namespace */
124 #endif /* __CVC4__UPDATE_OSTREAM_H */