MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
mlDebug.h
Go to the documentation of this file.
1
/*************************************************************************************
2
**
3
** Copyright 2007, MeVis Medical Solutions AG
4
**
5
** The user may use this file in accordance with the license agreement provided with
6
** the Software or, alternatively, in accordance with the terms contained in a
7
** written agreement between the user and MeVis Medical Solutions AG.
8
**
9
** For further information use the contact form at https://www.mevislab.de/contact
10
**
11
**************************************************************************************/
12
13
#ifndef ML_DEBUG_H
14
#define ML_DEBUG_H
15
17
67
#include "
mlErrorOutput.h
"
68
#include "
mlErrorOutputInfos.h
"
69
70
//--------------------------------------------------------------------------------------------
71
//
74
//
75
//--------------------------------------------------------------------------------------------
76
77
78
//--------------------------------------------------------------------------------------------
81
//--------------------------------------------------------------------------------------------
82
#ifdef _DEBUG
83
// Implements outputting debug information in debug mode.
84
#define _mlDebugConst(ENV_VAR, COUTS) \
85
{ \
86
/* Print debug infor only if global debug state is non zero. */
\
87
if ((ML_NAMESPACE::MLErrorOutput.getMessageFilter() & ML_DEBUG) || \
88
(ML_NAMESPACE::MLErrorOutput.isFullDebuggingOn())) \
89
{ \
90
/* Redirect debug output into a stream buffer. */
\
91
/* Be sure that the stream is terminated to avoid crashes. */
\
92
std::stringstream __ML_local_TMp_streamBuFfer; \
93
__ML_local_TMp_streamBuFfer << COUTS << '\0'; \
94
ML_NAMESPACE::MLErrorOutput.handleDebugPrint(ENV_VAR, ML_PREFIX, __ML_local_TMp_streamBuFfer, __FILE__, \
95
__LINE__); \
96
} \
97
}
98
#else
99
// Do not code anything in release mode.
100
#define _mlDebugConst(ENV_VAR, COUTS)
101
#endif
102
103
//--------------------------------------------------------------------------------------------
107
//--------------------------------------------------------------------------------------------
108
#define mlDebugConst(ENV_VAR, COUTS) _mlDebugConst(ENV_VAR, COUTS)
109
110
//--------------------------------------------------------------------------------------------
119
//--------------------------------------------------------------------------------------------
120
#ifdef _DEBUG
121
#define mlDebug(COUTS) \
122
{ \
123
const RuntimeType* rt = getClassTypeId(); \
124
ML_CHECK_RUNTIME_TYPE(rt); \
125
_mlDebugConst(std::string{ML_CONSTANT_PREFIX} + rt->getName(), COUTS); \
126
}
127
#else
128
#define mlDebug(COUTS)
129
#endif
130
131
//--------------------------------------------------------------------------------------------
139
//--------------------------------------------------------------------------------------------
140
#define mlDebugPrint(COUTS) _mlDebugConst(ML_DEBUG_ENV_NAME, COUTS)
141
142
//--------------------------------------------------------------------------------------------
151
//--------------------------------------------------------------------------------------------
152
#ifdef _DEBUG
153
#define mlDebugClass(CLASS_NAME, COUTS) \
154
{ \
155
const RuntimeType* rt = CLASS_NAME::getClassTypeId(); \
156
ML_CHECK_RUNTIME_TYPE(rt); \
157
_mlDebugConst(std::string{ML_CONSTANT_PREFIX} + rt->getName(), COUTS); \
158
}
159
#else
160
#define mlDebugClass(CLASS_NAME, COUTS)
161
#endif
163
164
165
#endif
// End of __mlDebug_H
mlErrorOutputInfos.h
mlErrorOutput.h
MeVis
Foundation
Sources
MLUtilities
mlDebug.h
Generated by
1.10.0