cvc4-1.3
dump.h
Go to the documentation of this file.
1 /********************* */
17 #include "cvc4_public.h"
18 
19 #ifndef __CVC4__DUMP_H
20 #define __CVC4__DUMP_H
21 
22 #include "expr/command.h"
23 
24 namespace CVC4 {
25 
27 
28 #if defined(CVC4_DUMPING) && !defined(CVC4_MUZZLE)
29  std::ostream* d_os;
30 #endif /* CVC4_DUMPING && !CVC4_MUZZLE */
31 
32 #ifdef CVC4_PORTFOLIO
33  CommandSequence* d_commands;
34 #endif /* CVC4_PORTFOLIO */
35 
36 public:
37  CVC4dumpstream() throw()
38 #if defined(CVC4_DUMPING) && !defined(CVC4_MUZZLE) && defined(CVC4_PORTFOLIO)
39  : d_os(NULL), d_commands(NULL)
40 #elif defined(CVC4_DUMPING) && !defined(CVC4_MUZZLE)
41  : d_os(NULL)
42 #elif defined(CVC4_PORTFOLIO)
43  : d_commands(NULL)
44 #endif /* CVC4_PORTFOLIO */
45  { }
46 
47  CVC4dumpstream(std::ostream& os, CommandSequence& commands) throw()
48 #if defined(CVC4_DUMPING) && !defined(CVC4_MUZZLE) && defined(CVC4_PORTFOLIO)
49  : d_os(&os), d_commands(&commands)
50 #elif defined(CVC4_DUMPING) && !defined(CVC4_MUZZLE)
51  : d_os(&os)
52 #elif defined(CVC4_PORTFOLIO)
53  : d_commands(&commands)
54 #endif /* CVC4_PORTFOLIO */
55  { }
56 
58 #if defined(CVC4_DUMPING) && !defined(CVC4_MUZZLE)
59  if(d_os != NULL) {
60  (*d_os) << c << std::endl;
61  }
62 #endif
63 #if defined(CVC4_PORTFOLIO)
64  if(d_commands != NULL) {
65  d_commands->addCommand(c.clone());
66  }
67 #endif
68  return *this;
69  }
70 };/* class CVC4dumpstream */
71 
74  std::set<std::string> d_tags;
75  CommandSequence d_commands;
76 
77 public:
78  CVC4dumpstream operator()(const char* tag) {
79  if(!d_tags.empty() && d_tags.find(std::string(tag)) != d_tags.end()) {
80  return CVC4dumpstream(getStream(), d_commands);
81  } else {
82  return CVC4dumpstream();
83  }
84  }
85  CVC4dumpstream operator()(std::string tag) {
86  if(!d_tags.empty() && d_tags.find(tag) != d_tags.end()) {
87  return CVC4dumpstream(getStream(), d_commands);
88  } else {
89  return CVC4dumpstream();
90  }
91  }
92 
93  void clear() { d_commands.clear(); }
94  const CommandSequence& getCommands() const { return d_commands; }
95 
96  bool on (const char* tag) { d_tags.insert(std::string(tag)); return true; }
97  bool on (std::string tag) { d_tags.insert(tag); return true; }
98  bool off(const char* tag) { d_tags.erase (std::string(tag)); return false; }
99  bool off(std::string tag) { d_tags.erase (tag); return false; }
100  bool off() { d_tags.clear(); return false; }
101 
102  bool isOn(const char* tag) { return d_tags.find(std::string(tag)) != d_tags.end(); }
103  bool isOn(std::string tag) { return d_tags.find(tag) != d_tags.end(); }
104 
105  std::ostream& setStream(std::ostream& os) { DumpOut.setStream(os); return os; }
106  std::ostream& getStream() { return DumpOut.getStream(); }
107 };/* class DumpC */
108 
110 extern DumpC DumpChannel CVC4_PUBLIC;
111 
112 #define Dump ::CVC4::DumpChannel
113 
114 }/* CVC4 namespace */
115 
116 #endif /* __CVC4__DUMP_H */
CVC4dumpstream & operator<<(const Command &c)
Definition: dump.h:57
void clear()
Definition: dump.h:93
DumpC DumpChannel
The dump singleton.
Implementation of the command pattern on SmtEngines.
std::ostream & setStream(std::ostream &os)
Definition: dump.h:105
bool isOn(const char *tag)
Definition: dump.h:102
bool off()
Definition: dump.h:100
bool isOn(std::string tag)
Definition: dump.h:103
The dump class.
Definition: dump.h:73
bool off(std::string tag)
Definition: dump.h:99
std::ostream & getStream()
Definition: dump.h:106
This is CVC4 release version For build and installation please see the INSTALL file included with this distribution This first official release of CVC4 is the result of more than three years of efforts by researchers at New York University and The University of Iowa The project leaders are Clark please refer to the AUTHORS file in the source distribution CVC4 is a tool for determining the satisfiability of a first order formula modulo a first order CVC CVC3 but does not directly incorporate code from any previous version CVC4 is intended to be an open and extensible SMT engine It can be used as a stand alone tool or as a library It has been designed to increase the performance and reduce the memory overhead of its predecessors It is written entirely in C and is released under a free software see the INSTALL file that comes with this distribution We recommend that you visit our CVC4 tutorials online please write to the cvc users cs nyu edu mailing list *if you need to report a bug with CVC4
Definition: README:39
CVC4dumpstream(std::ostream &os, CommandSequence &commands)
Definition: dump.h:47
#define CVC4_PUBLIC
Definition: cvc4_public.h:30
CVC4dumpstream operator()(const char *tag)
Definition: dump.h:78
const CommandSequence & getCommands() const
Definition: dump.h:94
Macros that should be defined everywhere during the building of the libraries and driver binary...
virtual Command * clone() const =0
Clone this Command (make a shallow copy).
bool on(std::string tag)
Definition: dump.h:97
bool on(const char *tag)
Definition: dump.h:96
bool off(const char *tag)
Definition: dump.h:98
CVC4dumpstream operator()(std::string tag)
Definition: dump.h:85