libwreport
2.9
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
wreport
notes.h
1
/*
2
* wreport/notes - Collect notes about unusual processing
3
*
4
* Copyright (C) 2011 ARPA-SIM <urpsim@smr.arpa.emr.it>
5
*
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License.
9
*
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
*
19
* Author: Enrico Zini <enrico@enricozini.com>
20
*/
21
22
#ifndef WREPORT_NOTES_H
23
#define WREPORT_NOTES_H
24
25
#include <iosfwd>
26
27
#ifndef WREPORT_PRINTF_ATTRS
28
#define WREPORT_PRINTF_ATTRS(a, b) __attribute__ ((format(printf, a, b)))
29
#endif
30
31
namespace
wreport {
32
39
namespace
notes {
40
42
void
set_target
(std::ostream& out);
43
45
std::ostream*
get_target
();
46
48
bool
logs
()
throw
();
49
51
std::ostream&
log
()
throw
();
52
54
void
logf
(
const
char
* fmt, ...) WREPORT_PRINTF_ATTRS(1, 2);
55
62
struct
Collect
63
{
67
std::ostream*
old
;
68
70
Collect
(std::ostream& out)
71
{
72
old
=
get_target
();
73
set_target
(out);
74
}
75
~
Collect
()
76
{
77
set_target
(*
old
);
78
}
79
};
80
81
}
82
83
}
84
85
/* vim:set ts=4 sw=4: */
86
#endif
Generated on Wed Oct 23 2013 08:51:49 for libwreport by
1.8.4