summaryrefslogtreecommitdiff
path: root/src/util/output.h
blob: 21b7b6e4ce04b633327f848960f84dc794816c2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*********************                                           -*- C++ -*-  */
/** output.h
 ** This file is part of the CVC4 prototype.
 ** Copyright (c) 2009 The Analysis of Computer Systems Group (ACSys)
 ** Courant Institute of Mathematical Sciences
 ** New York University
 ** See the file COPYING in the top-level source directory for licensing
 ** information.
 **
 ** Output utility classes and functions.
 **/

#ifndef __CVC4__OUTPUT_H
#define __CVC4__OUTPUT_H

#include <iostream>
#include <string>
#include <set>
#include "util/exception.h"

namespace CVC4 {

class Debug {
  std::set<std::string> d_tags;
  std::ostream &d_out;

public:
  static void operator()(const char* tag, const char*);
  static void operator()(const char* tag, std::string);
  static void operator()(string tag, const char*);
  static void operator()(string tag, std::string);
  static void operator()(const char*);// Yeting option
  static void operator()(std::string);// Yeting option

  static void printf(const char* tag, const char* fmt, ...) __attribute__ ((format(printf, 2, 3)));
  static void printf(const char* tag, std::string fmt, ...) __attribute__ ((format(printf, 2, 3)));
  static void printf(std::string tag, const char* fmt, ...) __attribute__ ((format(printf, 2, 3)));
  static void printf(std::string tag, std::string fmt, ...) __attribute__ ((format(printf, 2, 3)));
  // Yeting option not possible here

  static std::ostream& operator()(const char* tag);
  static std::ostream& operator()(std::string tag);
  static std::ostream& operator()();// Yeting option

  static void on (const char* tag) { d_tags.insert(std::string(tag)); }
  static void on (std::string tag) { d_tags.insert(tag);              }
  static void off(const char* tag) { d_tags.erase (std::string(tag)); }
  static void off(std::string tag) { d_tags.erase (tag);              }

  static void setStream(std::ostream& os) { d_out = os; }
};/* class Debug */


class Warning {
  std::ostream &d_out;

public:
  static void operator()(const char*);
  static void operator()(std::string);

  static void printf(const char* fmt, ...) __attribute__ ((format(printf, 2, 3)));
  static void printf(std::string fmt, ...) __attribute__ ((format(printf, 2, 3)));

  static std::ostream& operator()();

  static void setStream(std::ostream& os) { d_out = os; }
};/* class Warning */


class Notice {
  std::ostream &d_os;

public:
  static void operator()(const char*);
  static void operator()(std::string);

  static void printf(const char* fmt, ...) __attribute__ ((format(printf, 2, 3)));
  static void printf(std::string fmt, ...) __attribute__ ((format(printf, 2, 3)));

  static std::ostream& operator()();

  static void setStream(std::ostream& os) { d_out = os; }
};/* class Notice */


class Chat {
  std::ostream &d_os;

public:
  static void operator()(const char*);
  static void operator()(std::string);

  static void printf(const char* fmt, ...) __attribute__ ((format(printf, 2, 3)));
  static void printf(std::string fmt, ...) __attribute__ ((format(printf, 2, 3)));

  static std::ostream& operator()();

  static void setStream(std::ostream& os) { d_out = os; }
};/* class Chat */


class Trace {
  std::ostream &d_os;

public:
  static void operator()(const char* tag, const char*);
  static void operator()(const char* tag, std::string);
  static void operator()(string tag, const char*);
  static void operator()(string tag, std::string);

  static void printf(const char* tag, const char* fmt, ...) __attribute__ ((format(printf, 2, 3))) {
    va_list vl;
    va_start(vl, fmt);
    vfprintf(buf, 1024, fmt, vl);
    va_end(vl);
  }
  static void printf(const char* tag, std::string fmt, ...) __attribute__ ((format(printf, 2, 3))) {
  }
  static void printf(std::string tag, const char* fmt, ...) __attribute__ ((format(printf, 2, 3))) {
  }
  static void printf(std::string tag, std::string fmt, ...) __attribute__ ((format(printf, 2, 3))) {
  }

  static std::ostream& operator()(const char* tag);
  static std::ostream& operator()(std::string tag);

  static void on (const char* tag) { d_tags.insert(std::string(tag)); };
  static void on (std::string tag) { d_tags.insert(tag);              };
  static void off(const char* tag) { d_tags.erase (std::string(tag)); };
  static void off(std::string tag) { d_tags.erase (tag);              };

  static void setStream(std::ostream& os) { d_out = os; }
};/* class Trace */


}/* CVC4 namespace */

#endif /* __CVC4__OUTPUT_H */
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback