go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
elxMacro.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright UMC Utrecht and contributors
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18#ifndef elxMacro_h
19#define elxMacro_h
20
21// Avoid creation of multiple instances of `itk::ImageIOFactoryRegisterManager`, `itk::MeshIOFactoryRegisterManager`,
22// and `itk::TransformIOFactoryRegisterManager`.
23#undef ITK_IO_FACTORY_REGISTER_MANAGER
24
33#include "itkWin32Header.h"
34#include "itkMacro.h"
35
97#define elxInstallMacro(_classname) \
98 template <unsigned VIndex> \
99 class ITK_TEMPLATE_EXPORT _classname##_install \
100 { \
101 public: \
102 static int \
103 DO(::elastix::ComponentDatabase * cdb) \
104 { \
105 using ElastixType = typename ::elastix::ElastixTypedef<VIndex>::ElastixType; \
106 const auto name = ::elastix::_classname<ElastixType>::elxGetClassNameStatic(); \
107 const int dummy = \
108 ::elastix::InstallFunctions<::elastix::_classname<ElastixType>>::InstallComponent(name, VIndex, cdb); \
109 if (::elastix::ElastixTypedef<VIndex + 1>::IsDefined) \
110 { \
111 return _classname##_install<VIndex + 1>::DO(cdb); \
112 } \
113 return dummy; \
114 } \
115 }; \
116 template <> \
117 class _classname##_install<::elastix::NrOfSupportedImageTypes + 1> \
118 { \
119 public: \
120 static int \
121 DO(::elastix::ComponentDatabase * ) \
122 { \
123 return 0; \
124 } \
125 }; \
126 extern "C" int _classname##InstallComponent(::elastix::ComponentDatabase * _cdb) \
127 { \
128 int _InstallDummy##_classname = _classname##_install<1>::DO(_cdb); \
129 return _InstallDummy##_classname; \
130 } // ignore semicolon
131
132
152#define elxClassNameMacro(_name) \
153 static const char * elxGetClassNameStatic() { return _name; } \
154 const char * elxGetClassName() const override { return _name; }
155
159#define elxDeclarePureVirtualGetSelfMacro(type) \
160 virtual const type & GetSelf() const override = 0; \
161 virtual type & GetSelf() override = 0
162
167#define elxOverrideGetSelfMacro \
168 auto GetSelf() const->decltype(*this) override { return *this; } \
169 auto GetSelf()->decltype(*this) override { return *this; } \
170 static void GetSelf(const void *) = delete
171
172
184#define elxout ::xl::xout["standard"]
185
186/********************************************************************************
187 * *
188 * Dll export *
189 * *
190 ********************************************************************************/
191
192#if (defined(_WIN32) || defined(WIN32))
193# define ELASTIXLIB_API
194#else
195# if (__GNUC__ >= 4 || defined(__clang__))
196# define ELASTIXLIB_API __attribute__((visibility("default")))
197# else
198# define ELASTIXLIB_API
199# endif
200#endif
201
202#endif // end #ifndef elxMacro_h


Generated on 2023-01-13 for elastix by doxygen 1.9.6 elastix logo