Medical Imaging Interaction Toolkit
2026.06.00
Medical Imaging Interaction Toolkit
mitkExceptionMacro.h
Go to the documentation of this file.
1
/*============================================================================
2
3
The Medical Imaging Interaction Toolkit (MITK)
4
5
Copyright (c) German Cancer Research Center (DKFZ)
6
All rights reserved.
7
8
Use of this source code is governed by a 3-clause BSD license that can be
9
found in the LICENSE file.
10
11
============================================================================*/
12
13
#ifndef mitkExceptionMacro_h
14
#define mitkExceptionMacro_h
15
16
#include <
mitkException.h
>
17
#include <itkMacro.h>
18
#include <
mitkLog.h
>
19
#include <sstream>
20
31
#define mitkThrow() throw mitk::Exception(__FILE__, __LINE__, ""
, ITK_LOCATION)
32
56
#define mitkReThrow(mitkexception) \
57
mitkexception.AddRethrowData(__FILE__, __LINE__, "Rethrow by mitkReThrow macro."
); \
58
throw mitkexception
59
74
#define mitkThrowException(classname) throw classname(__FILE__, __LINE__, ""
, ITK_LOCATION)
75
88
#define mitkExceptionClassMacro(ClassName, SuperClassName) \
89
ClassName(const char *file, unsigned int lineNumber, const char *desc, const char *loc) \
90
: SuperClassName(file, lineNumber, desc, loc) \
91
{ \
92
} \
93
itkTypeMacro(ClassName, SuperClassName); \
94
\
95
template <class T> \
96
inline ClassName &operator<<(const T &data) \
97
{ \
98
std::stringstream ss; \
99
ss << this->GetDescription() << data; \
100
this->SetDescription(ss.str()); \
101
return *this; \
102
} \
103
\
104
template <class T> \
105
inline ClassName &operator<<(T &data) \
106
{ \
107
std::stringstream ss; \
108
ss << this->GetDescription() << data; \
109
this->SetDescription(ss.str()); \
110
return *this; \
111
} \
112
\
113
inline ClassName &operator<<(std::ostream &(*func)(std::ostream &)) \
114
{ \
115
std::stringstream ss; \
116
ss << this->GetDescription() << func; \
117
this->SetDescription(ss.str()); \
118
return *this; \
119
}
120
121
#endif
mitkException.h
mitkLog.h
src
MITK
Modules
Core
include
mitkExceptionMacro.h
Generated by
1.9.1