Medical Imaging Interaction Toolkit
2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkCommon.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 MITK_COMMON_H_DEFINED
14
#define MITK_COMMON_H_DEFINED
15
16
#ifdef _MSC_VER
17
// This warns about truncation to 255 characters in debug/browse info
18
#pragma warning(disable : 4786)
19
#pragma warning(disable : 4068)
/* disable unknown pragma warnings */
20
#endif
21
22
// add only those headers here that are really necessary for all classes!
23
#include "itkObject.h"
24
#include "
mitkConfig.h
"
25
#include "
mitkExceptionMacro.h
"
26
#include "
mitkGetClassHierarchy.h
"
27
#include "
mitkLogMacros.h
"
28
29
#ifndef MITK_UNMANGLE_IPPIC
30
#define mitkIpPicDescriptor mitkIpPicDescriptor
31
#endif
32
33
typedef
unsigned
int
MapperSlotId
;
34
40
#define mitkClassMacro(className, SuperClassName) \
41
typedef className Self; \
42
typedef SuperClassName Superclass; \
43
typedef itk::SmartPointer<Self> Pointer; \
44
typedef itk::SmartPointer<const Self> ConstPointer; \
45
static const char *GetStaticNameOfClass() { return #className; } \
46
virtual std::vector<std::string> GetClassHierarchy() const override { return mitk::GetClassHierarchy<Self>(); } \
47
itkTypeMacro(className, SuperClassName);
48
49
#define mitkClassMacroItkParent(className, SuperClassName) \
50
typedef className Self; \
51
typedef SuperClassName Superclass; \
52
typedef itk::SmartPointer<Self> Pointer; \
53
typedef itk::SmartPointer<const Self> ConstPointer; \
54
static const char *GetStaticNameOfClass() { return #className; } \
55
virtual std::vector<std::string> GetClassHierarchy() const { return mitk::GetClassHierarchy<Self>(); } \
56
itkTypeMacro(className, SuperClassName);
57
61
#define mitkClassMacroNoParent(className) \
62
typedef className Self; \
63
typedef itk::SmartPointer<Self> Pointer; \
64
typedef itk::SmartPointer<const Self> ConstPointer; \
65
static const char *GetStaticNameOfClass() { return #className; } \
66
virtual std::vector<std::string> GetClassHierarchy() const { return mitk::GetClassHierarchy<Self>(); } \
67
itkTypeMacroNoParent(className)
68
72
#define mitkNewMacro1Param(classname, type) \
73
\
74
static Pointer New(type _arg) \
75
\
76
{ \
77
Pointer smartPtr = new classname(_arg); \
78
smartPtr->UnRegister(); \
79
return smartPtr; \
80
}
81
85
#define mitkNewMacro2Param(classname, typea, typeb) \
86
\
87
static Pointer New(typea _arga, typeb _argb) \
88
\
89
{ \
90
Pointer smartPtr = new classname(_arga, _argb); \
91
smartPtr->UnRegister(); \
92
return smartPtr; \
93
}
94
98
#define mitkNewMacro3Param(classname, typea, typeb, typec) \
99
\
100
static Pointer New(typea _arga, typeb _argb, typec _argc) \
101
\
102
{ \
103
Pointer smartPtr = new classname(_arga, _argb, _argc); \
104
smartPtr->UnRegister(); \
105
return smartPtr; \
106
}
107
111
#define mitkNewMacro4Param(classname, typea, typeb, typec, typed) \
112
\
113
static Pointer New(typea _arga, typeb _argb, typec _argc, typed _argd) \
114
\
115
{ \
116
Pointer smartPtr = new classname(_arga, _argb, _argc, _argd); \
117
smartPtr->UnRegister(); \
118
return smartPtr; \
119
}
120
124
#define mitkNewMacro5Param(classname, typea, typeb, typec, typed, typee) \
125
\
126
static Pointer New(typea _arga, typeb _argb, typec _argc, typed _argd, typee _arge) \
127
\
128
{ \
129
Pointer smartPtr = new classname(_arga, _argb, _argc, _argd, _arge); \
130
smartPtr->UnRegister(); \
131
return smartPtr; \
132
}
133
137
#define mitkNewMacro6Param(classname, typea, typeb, typec, typed, typee, typef) \
138
\
139
static Pointer New(typea _arga, typeb _argb, typec _argc, typed _argd, typee _arge, typef _argf) \
140
\
141
{ \
142
Pointer smartPtr = new classname(_arga, _argb, _argc, _argd, _arge, _argf); \
143
smartPtr->UnRegister(); \
144
return smartPtr; \
145
}
146
149
#define mitkGetObjectMacroConst(name, type) \
150
virtual type *Get##name() const \
151
{ \
152
itkDebugMacro("returning " #name " address " << this->m_##name); \
153
return this->m_##name.GetPointer(); \
154
}
155
158
#define mitkCloneMacro(classname) \
159
virtual itk::LightObject::Pointer InternalClone() const override \
160
\
161
{ \
162
Pointer smartPtr = new classname(*this); \
163
smartPtr->UnRegister(); \
164
return smartPtr.GetPointer(); \
165
}
166
171
#ifdef MITK_NO_DEPRECATED_WARNINGS
172
#define DEPRECATED(func) func
173
#elif defined(__GNUC__)
174
#define DEPRECATED(...) __VA_ARGS__ __attribute__((deprecated))
175
#elif defined(_MSC_VER)
176
#define DEPRECATED(...) __declspec(deprecated)##__VA_ARGS__
177
#else
178
#pragma message("WARNING: You need to implement DEPRECATED for your compiler!")
179
#define DEPRECATED(func) func
180
#endif
181
186
#if defined(__clang__) || defined(__GNUC__)
187
#define MITK_EXPORT __attribute__((visibility("default")))
188
#define MITK_IMPORT __attribute__((visibility("default")))
189
#define MITK_LOCAL __attribute__((visibility("hidden")))
190
#elif defined(WIN32)
191
#define MITK_EXPORT __declspec(dllexport)
192
#define MITK_IMPORT __declspec(dllimport)
193
#define MITK_LOCAL
194
#else
195
#define MITK_EXPORT
196
#define MITK_IMPORT
197
#define MITK_LOCAL
198
#endif
199
200
#endif // MITK_COMMON_H_DEFINED
mitkExceptionMacro.h
mitkGetClassHierarchy.h
mitkLogMacros.h
mitkConfig.h
MapperSlotId
unsigned int MapperSlotId
Definition:
mitkCommon.h:33
Source
Modules
Core
include
mitkCommon.h
Generated on Thu Mar 12 2020 10:23:40 for Medical Imaging Interaction Toolkit by
1.8.13