-
Notifications
You must be signed in to change notification settings - Fork 0
/
Diagnostic.h
101 lines (77 loc) · 2.03 KB
/
Diagnostic.h
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
// -*- C++ -*-
//
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Michael A.G. Aivazis
// California Institute of Technology
// (C) 1998-2005 All Rights Reserved
//
// <LicenseText>
//
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
#if !defined(journal_Diagnostic_h)
#define journal_Diagnostic_h
// forward declarations
namespace journal {
class Entry;
class Facility;
class Journal;
class Diagnostic;
}
// injection operator
template <typename item_t>
inline journal::Diagnostic & operator<< (journal::Diagnostic &, const item_t &);
class journal::Diagnostic {
// types
public:
typedef Entry entry_t;
typedef Facility state_t;
typedef Journal journal_t;
typedef std::string string_t;
typedef std::stringstream buffer_t;
// interface
public:
void state(bool);
bool state() const;
inline void activate();
inline void deactivate();
inline string_t facility() const;
// entry manipulation
void record();
void newline();
void attribute(string_t, string_t);
// access to the buffered data
inline string_t str() const;
// access to the journal singleton
static journal_t & journal();
// builtin data type injection
template <typename item_t>
inline Diagnostic & inject(const item_t & datum);
// meta-methods
public:
~Diagnostic();
Diagnostic(string_t, string_t, state_t &);
// implementation
private:
void _newline();
// disable these
private:
Diagnostic(const Diagnostic &);
const Diagnostic & operator=(const Diagnostic &);
// data
private:
const string_t _facility;
const string_t _severity;
state_t & _state;
buffer_t _buffer;
entry_t * _entry;
};
// get the inline definitions
#define journal_Diagnostic_icc
#include "Diagnostic.icc"
#undef journal_Diagnostic_icc
#endif
// version
// $Id: Diagnostic.h,v 1.1.1.1 2006-11-27 00:09:37 aivazis Exp $
// End of file