Medical Imaging Interaction Toolkit
2024.12.99-0da743f6
Medical Imaging Interaction Toolkit
mitkSerializerMacros.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 mitkSerializerMacros_h
14
#define mitkSerializerMacros_h
15
16
#include <itkObjectFactoryBase.h>
17
#include <itkVersion.h>
18
19
#define MITK_REGISTER_SERIALIZER(classname) \
20
\
21
\
22
namespace mitk \
23
\
24
{ \
25
\
26
class classname##Factory : public ::itk::ObjectFactoryBase \
27
\
28
{ \
29
public: \
30
/* ITK typedefs */
\
31
typedef classname##Factory Self; \
32
typedef itk::ObjectFactoryBase Superclass; \
33
typedef itk::SmartPointer<Self> Pointer; \
34
typedef itk::SmartPointer<const Self> ConstPointer; \
35
\
36
/* Methods from ObjectFactoryBase */
\
37
virtual const char *GetITKSourceVersion() const override { return ITK_SOURCE_VERSION; } \
38
virtual const char *GetDescription() const override { return "Generated factory for " #classname; } \
39
/* Method for class instantiation. */
\
40
itkFactorylessNewMacro(Self); \
41
\
42
/* Run-time type information (and related methods). */
\
43
itkTypeMacro(classname##Factory, itkObjectFactoryBase); \
44
\
45
protected: \
46
classname##Factory() \
47
{ \
48
itk::ObjectFactoryBase::RegisterOverride(#classname, \
49
#classname, \
50
"Generated factory for " #classname, \
51
1, \
52
itk::CreateObjectFunction<classname>::New()); \
53
} \
54
\
55
~classname##Factory() {} \
56
private: \
57
classname##Factory(const Self &);
/* purposely not implemented */
\
58
void operator=(const Self &);
/* purposely not implemented */
\
59
\
60
}; \
61
\
62
class classname##RegistrationMethod \
63
{ \
64
public: \
65
classname##RegistrationMethod() \
66
{ \
67
m_Factory = classname##Factory::New(); \
68
itk::ObjectFactoryBase::RegisterFactory(m_Factory); \
69
} \
70
\
71
~classname##RegistrationMethod() { itk::ObjectFactoryBase::UnRegisterFactory(m_Factory); } \
72
private: \
73
classname##Factory::Pointer m_Factory; \
74
}; \
75
\
76
} \
77
\
78
static mitk::classname##RegistrationMethod somestaticinitializer_##classname;
79
80
#endif
src
MITK
Modules
SceneSerializationBase
include
mitkSerializerMacros.h
Generated on Tue Dec 24 2024 02:12:28 for Medical Imaging Interaction Toolkit by
1.8.17