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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
/*
* Inkscape::Debug::Logger - debug logging facility
*
* Authors:
* MenTaLguY <mental@rydia.net>
*
* Copyright (C) 2005 MenTaLguY
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifndef SEEN_INKSCAPE_DEBUG_LOGGER_H
#define SEEN_INKSCAPE_DEBUG_LOGGER_H
#include "debug/event.h"
namespace Inkscape {
namespace Debug {
class Logger {
public:
static void init();
template <typename EventType>
inline static void start() {
if (_enabled) {
if (_category_mask[EventType::category()]) {
_start(EventType());
} else {
_skip();
}
}
}
template <typename EventType, typename A>
inline static void start(A const &a) {
if (_enabled) {
if (_category_mask[EventType::category()]) {
_start(EventType(a));
} else {
_skip();
}
}
}
template <typename EventType, typename A, typename B>
inline static void start(A const &a, B const &b) {
if (_enabled) {
if (_category_mask[EventType::category()]) {
_start(EventType(a, b));
} else {
_skip();
}
}
}
template <typename EventType, typename A, typename B, typename C>
inline static void start(A const &a, B const &b, C const &c) {
if (_enabled) {
if (_category_mask[EventType::category()]) {
_start(EventType(a, b, c));
} else {
_skip();
}
}
}
template <typename EventType, typename A, typename B,
typename C, typename D>
inline static void start(A const &a, B const &b, C const &c, D const &d) {
if (_enabled) {
if (_category_mask[EventType::category()]) {
_start(EventType(a, b, c, d));
} else {
_skip();
}
}
}
template <typename EventType, typename A, typename B, typename C,
typename D, typename E>
inline static void start(A const &a, B const &b, C const &c,
D const &d, E const &e)
{
if (_enabled) {
if (_category_mask[EventType::category()]) {
_start(EventType(a, b, c, d, e));
} else {
_skip();
}
}
}
template <typename EventType, typename A, typename B, typename C,
typename D, typename E, typename F>
inline static void start(A const &a, B const &b, C const &c,
D const &d, E const &e, F const &f)
{
if (_enabled) {
if (_category_mask[EventType::category()]) {
_start(EventType(a, b, c, d, e, f));
} else {
_skip();
}
}
}
template <typename EventType, typename A, typename B, typename C,
typename D, typename E, typename F,
typename G>
inline static void start(A const &a, B const &b, C const &c, D const &d,
E const &e, F const &f, G const &g)
{
if (_enabled) {
if (_category_mask[EventType::category()]) {
_start(EventType(a, b, c, d, e, f, g));
} else {
_skip();
}
}
}
template <typename EventType, typename A, typename B, typename C,
typename D, typename E, typename F,
typename G, typename H>
inline static void start(A const &a, B const &b, C const &c, D const &d,
E const &e, F const &f, G const &g, H const &h)
{
if (_enabled) {
if (_category_mask[EventType::category()]) {
_start(EventType(a, b, c, d, e, f, g, h));
} else {
_skip();
}
}
}
inline static void finish() {
if (_enabled) {
_finish();
}
}
static void shutdown();
private:
static bool _enabled;
static void _start(Event const &event);
static void _skip();
static void _finish();
static bool _category_mask[Event::N_CATEGORIES];
};
}
}
#endif
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
|