Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
blaze
util
logging
LogSection.h
Go to the documentation of this file.
1
//=================================================================================================
20
//=================================================================================================
21
22
#ifndef _BLAZE_UTIL_LOGGING_LOGSECTION_H_
23
#define _BLAZE_UTIL_LOGGING_LOGSECTION_H_
24
25
26
//*************************************************************************************************
27
// Includes
28
//*************************************************************************************************
29
30
#include <new>
31
#include <sstream>
32
#include <
blaze/system/Logging.h
>
33
#include <
blaze/util/logging/LogLevel.h
>
34
35
36
namespace
blaze {
37
38
namespace
logging {
39
40
//=================================================================================================
41
//
42
// CLASS DEFINITION
43
//
44
//=================================================================================================
45
46
//*************************************************************************************************
54
class
LogSection
55
{
56
public
:
57
//**Constructors********************************************************************************
60
LogSection
(
LogLevel
level );
61
inline
LogSection
(
const
LogSection
& ls );
63
//**********************************************************************************************
64
65
//**Destructor**********************************************************************************
68
~LogSection
();
70
//**********************************************************************************************
71
72
//**Conversion operators************************************************************************
75
inline
operator
bool()
const
;
76
inline
operator
std::ostream&();
78
//**********************************************************************************************
79
80
//**Logging functions***************************************************************************
83
template
<
typename
Type >
inline
void
log
(
const
Type& message );
84
void
commit
();
86
//**********************************************************************************************
87
88
private
:
89
//**Member variables****************************************************************************
92
LogLevel
level_
;
93
std::stringstream
message_
;
94
95
//**********************************************************************************************
96
97
//**Forbidden operations************************************************************************
100
LogSection
& operator=(
const
LogSection
& );
101
102
void
*
operator
new
( std::size_t )
throw
( std::bad_alloc );
103
void
*
operator
new
[]( std::size_t )
throw
( std::bad_alloc );
104
void
*
operator
new
( std::size_t,
const
std::nothrow_t& )
throw
();
105
void
*
operator
new
[]( std::size_t,
const
std::nothrow_t& )
throw
();
106
107
void
operator
delete
(
void
* )
throw
();
108
void
operator
delete
[](
void
* )
throw
();
109
void
operator
delete
(
void
*,
const
std::nothrow_t& )
throw
();
110
void
operator
delete
[](
void
*,
const
std::nothrow_t& )
throw
();
112
//**********************************************************************************************
113
};
114
//*************************************************************************************************
115
116
117
118
119
//=================================================================================================
120
//
121
// CONSTRUCTORS
122
//
123
//=================================================================================================
124
125
//*************************************************************************************************
133
inline
LogSection::LogSection
(
const
LogSection
& ls )
134
: level_( ls.level_ )
// The logging level of the log section
135
{}
136
//*************************************************************************************************
137
138
139
140
141
//=================================================================================================
142
//
143
// CONVERSION OPERATOR
144
//
145
//=================================================================================================
146
147
//*************************************************************************************************
152
inline
LogSection::operator bool()
const
153
{
154
return
true
;
155
}
156
//*************************************************************************************************
157
158
159
//*************************************************************************************************
164
inline
LogSection::operator std::ostream&()
165
{
166
return
message_;
167
}
168
//*************************************************************************************************
169
170
171
172
173
//=================================================================================================
174
//
175
// LOGGING FUNCTIONS
176
//
177
//=================================================================================================
178
179
//*************************************************************************************************
185
template
<
typename
Type >
// Type of the log message
186
inline
void
LogSection::log
(
const
Type& message )
187
{
188
message_
<< message;
189
}
190
//*************************************************************************************************
191
192
193
194
195
//=================================================================================================
196
//
197
// GLOBAL OPERATORS
198
//
199
//=================================================================================================
200
201
//*************************************************************************************************
204
template
<
typename
Type >
205
inline
LogSection
&
operator<<
(
LogSection
& logsection,
const
Type& message );
207
//*************************************************************************************************
208
209
210
//*************************************************************************************************
218
template
<
typename
Type >
// Type of the log message
219
inline
LogSection
&
operator<<
(
LogSection
& logsection,
const
Type& message )
220
{
221
logsection.
log
( message );
222
return
logsection;
223
}
224
//*************************************************************************************************
225
226
}
// namespace logging
227
228
}
// namespace blaze
229
230
#endif
Generated on Sun Jan 20 2013 08:14:38 by
1.8.3