GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/smt/update_ostream.h Lines: 1 41 2.4 %
Date: 2021-03-22 Branches: 0 38 0.0 %

Line Exec Source
1
/*********************                                                        */
2
/*! \file update_ostream.h
3
 ** \verbatim
4
 ** Top contributors (to current version):
5
 **   Tim King, Mathias Preiner, Aina Niemetz
6
 ** This file is part of the CVC4 project.
7
 ** Copyright (c) 2009-2021 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
11
 **
12
 ** \brief [[ Add one-line brief description here ]]
13
 **
14
 ** [[ Add lengthier description here ]]
15
 ** \todo document this file
16
 **/
17
18
#include "cvc4_private.h"
19
20
#ifndef CVC4__UPDATE_OSTREAM_H
21
#define CVC4__UPDATE_OSTREAM_H
22
23
#include <ostream>
24
25
#include "base/check.h"
26
#include "base/output.h"
27
#include "expr/expr_iomanip.h"
28
#include "options/base_options.h"
29
#include "options/language.h"
30
#include "options/set_language.h"
31
#include "smt/dump.h"
32
33
namespace CVC4 {
34
35
class ChannelSettings {
36
 public:
37
  ChannelSettings(std::ostream& out)
38
      : d_dagSetting(expr::ExprDag::getDag(out)),
39
        d_exprDepthSetting(expr::ExprSetDepth::getDepth(out)),
40
        d_languageSetting(language::SetLanguage::getLanguage(out))
41
  {}
42
43
  void apply(std::ostream& out) {
44
    out << expr::ExprDag(d_dagSetting);
45
    out << expr::ExprSetDepth(d_exprDepthSetting);
46
    out << language::SetLanguage(d_languageSetting);
47
  }
48
49
 private:
50
  const int d_dagSetting;
51
  const size_t d_exprDepthSetting;
52
  const OutputLanguage d_languageSetting;
53
}; /* class ChannelSettings */
54
55
class OstreamUpdate {
56
public:
57
  virtual ~OstreamUpdate(){}
58
59
  virtual std::ostream& get() = 0;
60
  virtual void set(std::ostream* setTo) = 0;
61
62
  void apply(std::ostream* setTo) {
63
    PrettyCheckArgument(setTo != NULL, setTo);
64
65
    ChannelSettings initialSettings(get());
66
    set(setTo);
67
    initialSettings.apply(get());
68
  }
69
}; /* class OstreamUpdate */
70
71
class OptionsErrOstreamUpdate : public OstreamUpdate {
72
 public:
73
30072
  std::ostream& get() override { return *(options::err()); }
74
  void set(std::ostream* setTo) override { return options::err.set(setTo); }
75
};  /* class OptionsErrOstreamUpdate */
76
77
class DumpOstreamUpdate : public OstreamUpdate {
78
 public:
79
  std::ostream& get() override { return Dump.getStream(); }
80
  void set(std::ostream* setTo) override { Dump.setStream(setTo); }
81
};  /* class DumpOstreamUpdate */
82
83
class DebugOstreamUpdate : public OstreamUpdate {
84
 public:
85
  std::ostream& get() override { return Debug.getStream(); }
86
  void set(std::ostream* setTo) override { Debug.setStream(setTo); }
87
};  /* class DebugOstreamUpdate */
88
89
class WarningOstreamUpdate : public OstreamUpdate {
90
 public:
91
  std::ostream& get() override { return Warning.getStream(); }
92
  void set(std::ostream* setTo) override { Warning.setStream(setTo); }
93
};  /* class WarningOstreamUpdate */
94
95
class MessageOstreamUpdate : public OstreamUpdate {
96
 public:
97
  std::ostream& get() override { return CVC4Message.getStream(); }
98
  void set(std::ostream* setTo) override { CVC4Message.setStream(setTo); }
99
};  /* class MessageOstreamUpdate */
100
101
class NoticeOstreamUpdate : public OstreamUpdate {
102
 public:
103
  std::ostream& get() override { return Notice.getStream(); }
104
  void set(std::ostream* setTo) override { Notice.setStream(setTo); }
105
};  /* class NoticeOstreamUpdate */
106
107
class ChatOstreamUpdate : public OstreamUpdate {
108
 public:
109
  std::ostream& get() override { return Chat.getStream(); }
110
  void set(std::ostream* setTo) override { Chat.setStream(setTo); }
111
};  /* class ChatOstreamUpdate */
112
113
class TraceOstreamUpdate : public OstreamUpdate {
114
 public:
115
  std::ostream& get() override { return Trace.getStream(); }
116
  void set(std::ostream* setTo) override { Trace.setStream(setTo); }
117
};  /* class TraceOstreamUpdate */
118
119
}/* CVC4 namespace */
120
121
#endif /* CVC4__UPDATE_OSTREAM_H */