ITK  5.3.0
Insight Toolkit
itkMacro.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright NumFOCUS
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 /*=========================================================================
19  *
20  * Portions of this file are subject to the VTK Toolkit Version 3 copyright.
21  *
22  * Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
23  *
24  * For complete copyright, license and disclaimer of warranty information
25  * please refer to the NOTICE file at the top of the ITK source tree.
26  *
27  *=========================================================================*/
38 #ifndef itkMacro_h
39 #define itkMacro_h
40 
41 #include "itkWin32Header.h"
42 #include "itkConfigure.h"
43 #include "ITKCommonExport.h"
44 
45 #include <typeinfo>
46 
47 #include <string>
48 #include <cstdlib>
49 #ifndef NDEBUG
50 # include <cassert>
51 #endif
52 
53 #include <sstream>
54 
59 namespace itk
60 {
61 // end namespace itk - this is here for documentation purposes
62 }
63 
66 #define itkNotUsed(x)
67 
68 // clang-format off
69 
79 # define ITK_NOOP_STATEMENT static_assert(true, "")
80 
81 
82 #if defined(ITK_FUTURE_LEGACY_REMOVE)
83 
84 # define ITK_MACROEND_NOOP_STATEMENT ITK_NOOP_STATEMENT
85 #else
86  /* NOTE: The ITK_MACROEND_NOOP_STATEMENT must be defined to nothing
87  * in order to maintain backwards compatibility with earlier macro
88  * uses that may or may not have ';' after the macro is used. */
89  /* Purposefully empty */
90 # define ITK_MACROEND_NOOP_STATEMENT
91 #endif
92 // clang-format on
93 
94 // Define ITK_PRAGMA macro.
95 //
96 // It sets "#pragma" preprocessor directives without expecting the arguments
97 // to be quoted.
98 #define ITK_PRAGMA(x) _Pragma(#x)
99 
100 // The clang compiler has many useful non-default compiler warnings
101 // that tend to have a high false positive rate.
102 // The following set of defines allows us to suppress false positives
103 // and still track down suspicious code
104 #if defined(__clang__) && defined(__has_warning)
105 # define CLANG_PRAGMA_PUSH ITK_PRAGMA(clang diagnostic push)
106 # define CLANG_PRAGMA_POP ITK_PRAGMA(clang diagnostic pop)
107 # if __has_warning("-Wfloat-equal")
108 # define CLANG_SUPPRESS_Wfloat_equal ITK_PRAGMA(clang diagnostic ignored "-Wfloat-equal")
109 # else
110 # define CLANG_SUPPRESS_Wfloat_equal
111 # endif
112 # if __has_warning("-Wc++14-extensions")
113 # define CLANG_SUPPRESS_Wc__14_extensions ITK_PRAGMA(clang diagnostic ignored "-Wc++14-extensions")
114 # else
115 # define CLANG_SUPPRESS_Wc__14_extensions
116 # endif
117 #else
118 # define CLANG_PRAGMA_PUSH
119 # define CLANG_PRAGMA_POP
120 # define CLANG_SUPPRESS_Wfloat_equal
121 # define CLANG_SUPPRESS_Wc__14_extensions
122 #endif
123 
124 // Intel compiler convenience macros
125 #if defined(__INTEL_COMPILER)
126 # define INTEL_PRAGMA_WARN_PUSH ITK_PRAGMA(warning push)
127 # define INTEL_PRAGMA_WARN_POP ITK_PRAGMA(warning pop)
128 # define INTEL_SUPPRESS_warning_1292 ITK_PRAGMA(warning disable 1292)
129 #else
130 # define INTEL_PRAGMA_WARN_PUSH
131 # define INTEL_PRAGMA_WARN_POP
132 # define INTEL_SUPPRESS_warning_1292
133 #endif
134 
135 // Define ITK_GCC_PRAGMA_DIAG(param1 [param2 [...]]) macro.
136 //
137 // This macro sets a pragma diagnostic
138 //
139 // Define ITK_GCC_PRAGMA_DIAG_(PUSH|POP) macros.
140 //
141 // These macros respectively push and pop the diagnostic context
142 //
143 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
144 # define ITK_GCC_PRAGMA_DIAG(x) ITK_PRAGMA(GCC diagnostic x)
145 # define ITK_GCC_PRAGMA_DIAG_PUSH() ITK_GCC_PRAGMA_DIAG(push)
146 # define ITK_GCC_PRAGMA_DIAG_POP() ITK_GCC_PRAGMA_DIAG(pop)
147 #else
148 # define ITK_GCC_PRAGMA_DIAG(x)
149 # define ITK_GCC_PRAGMA_DIAG_PUSH()
150 # define ITK_GCC_PRAGMA_DIAG_POP()
151 #endif
152 
153 /*
154  * ITK only supports MSVC++ 14.0 and greater
155  * MSVC++ 14.0 _MSC_VER == 1900 (Visual Studio 2015 version 14.0)
156  * MSVC++ 14.1 _MSC_VER == 1910 (Visual Studio 2017 version 15.0)
157  * MSVC++ 14.11 _MSC_VER == 1911 (Visual Studio 2017 version 15.3)
158  * MSVC++ 14.12 _MSC_VER == 1912 (Visual Studio 2017 version 15.5)
159  * MSVC++ 14.13 _MSC_VER == 1913 (Visual Studio 2017 version 15.6)
160  * MSVC++ 14.14 _MSC_VER == 1914 (Visual Studio 2017 version 15.7)
161  * MSVC++ 14.15 _MSC_VER == 1915 (Visual Studio 2017 version 15.8)
162  * MSVC++ 14.16 _MSC_VER == 1916 (Visual Studio 2017 version 15.9)
163  * MSVC++ 14.2 _MSC_VER == 1920 (Visual Studio 2019 Version 16.0)
164  */
165 #if defined(_MSC_VER) && (_MSC_VER < 1900)
166 # error "Visual Studio < 2015 is not supported under ITKv5"
167 #endif
168 #if defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x5140)
169 # error "SUNPro C++ < 5.14.0 is not supported under ITKv5 and above"
170 #endif
171 #if defined(__CYGWIN__)
172 # error "The Cygwin compiler is not supported in ITKv4 and above"
173 #endif
174 #if defined(__BORLANDC__)
175 # error "The Borland C compiler is not supported in ITKv4 and above"
176 #endif
177 #if defined(__MWERKS__)
178 # error "The MetroWerks compiler is not supported in ITKv4 and above"
179 #endif
180 #if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) && \
181  ((__GNUC__ < 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ < 8)))
182 # error "GCC < 4.8 is not supported under ITKv5"
183 #endif
184 #if defined(__sgi)
185 // This is true for IRIX 6.5.18m with MIPSPro 7.3.1.3m.
186 // TODO: At some future point, it may be necessary to
187 // define a minimum __sgi version that will work.
188 # error "The SGI compiler is not supported under ITKv4 and above"
189 #endif
190 #if defined(__APPLE__)
191 # if defined(__clang__) && (__cplusplus < 201103L)
192 # error "Apple LLVM < 5.0 (clang < 3.3) is not supported under ITKv5"
193 # endif
194 #elif defined(__clang__) && ((__clang_major__ < 3) || ((__clang_major__ == 3) && (__clang_minor__ < 3)))
195 # error "Clang < 3.3 is not supported under ITKv5"
196 #endif
197 #if defined(__INTEL_COMPILER) && (__INTEL_COMPILER < 1504)
198 # error "Intel C++ < 15.0.4 is not supported under ITKv5"
199 #endif
200 
201 // Setup symbol exports
202 #if defined(_WIN32) || defined(WIN32)
203 # define ITK_ABI_IMPORT __declspec(dllimport)
204 # define ITK_ABI_EXPORT __declspec(dllexport)
205 # define ITK_ABI_HIDDEN
206 #else
207 # if __GNUC__ >= 4
208 # define ITK_ABI_IMPORT __attribute__((visibility("default")))
209 # define ITK_ABI_EXPORT __attribute__((visibility("default")))
210 # define ITK_ABI_HIDDEN __attribute__((visibility("hidden")))
211 # else
212 # define ITK_ABI_IMPORT
213 # define ITK_ABI_EXPORT
214 # define ITK_ABI_HIDDEN
215 # endif
216 #endif
217 
218 // Setup symbol exports
219 #ifndef ITK_TEMPLATE_EXPORT
220 # ifdef ITK_TEMPLATE_VISIBILITY_DEFAULT
221 # define ITK_TEMPLATE_EXPORT __attribute__((visibility("default")))
222 # else
223 # define ITK_TEMPLATE_EXPORT
224 # endif
225 #endif
226 
227 // Setup symbol exports
228 #ifdef ITK_TEMPLATE_VISIBILITY_DEFAULT
229 # define ITK_FORCE_EXPORT_MACRO(moduleName) __attribute__((visibility("default")))
230 #else
231 # define ITK_FORCE_EXPORT_MACRO(moduleName) moduleName##_EXPORT
232 #endif
233 
234 #ifndef ITK_FORWARD_EXPORT
235 // If build with shared libraries, on MacOS, if USE_COMPILER_HIDDEN_VISIBILITY is ON
236 # if defined(__APPLE__) && defined(ITK_TEMPLATE_VISIBILITY_DEFAULT) && defined(ITK_BUILD_SHARED_LIBS) && \
237  defined(USE_COMPILER_HIDDEN_VISIBILITY)
238 # define ITK_FORWARD_EXPORT __attribute__((visibility("default")))
239 # else
240 # define ITK_FORWARD_EXPORT
241 # endif
242 #endif
243 
244 
245 //-*-*-*
246 // The following deprecations should be removed in ITKV6 and later
247 // NOTE DEPRECATED should be ITK_NOEXCEPT
248 #define ITK_NOEXCEPT_OR_THROW error "Replace ITK_NOEXCEPT_OR_THROW with ITK_NOEXCEPT"
249 // NOTE DEPRECATED! should be ITK_COMPILER_CXX_STATIC_ASSERT
250 #if !defined(ITK_LEGACY_REMOVE)
251 # define ITK_DELETE_FUNCTION = delete
252 #else
253 # define ITK_DELETE_FUNCTION error "Replace ITK_DELETE_FUNCTION with = delete"
254 #endif
255 //-*-*-*
256 
257 // DEPRECATED: These macros are left here for compatibility with remote modules.
258 // Once they have been removed from all known remote modules, this code should
259 // be removed.
260 #if defined(ITK_FUTURE_LEGACY_REMOVE)
261 # define ITK_CONSTEXPR_FUNC "Replace ITK_CONSTEXPR_FUNC with constexpr"
262 # define ITK_CONSTEXPR_VAR "Replace ITK_CONSTEXPR_VAR with constexpr"
263 
264 # define itkExposeEnumValue(name) static_cast<int>(name)
265 // Future remove# define itkExposeEnumValue(name) "Replace type of " # name " with proper enumeration instead of
266 // integer."
267 #else
268 # define ITK_CONSTEXPR_FUNC constexpr
269 # define ITK_CONSTEXPR_VAR constexpr
270 
272 # define itkExposeEnumValue(name) static_cast<int>(name)
273 #endif
274 
275 // Use "ITK_FALLTHROUGH;" to annotate deliberate fall-through in switches,
276 // use it analogously to "break;". The trailing semi-colon is required.
277 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
278 # if (__GNUC__ >= 7)
279 # define ITK_FALLTHROUGH __attribute__((fallthrough))
280 # endif
281 #elif defined(__has_warning)
282 # if __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough")
283 # define ITK_FALLTHROUGH [[clang::fallthrough]]
284 # endif
285 #endif
286 
287 #ifndef ITK_FALLTHROUGH
288 # define ITK_FALLTHROUGH ((void)0)
289 #endif
290 
311 #define itkNewMacro(x) \
312  itkSimpleNewMacro(x); \
313  itkCreateAnotherMacro(x); \
314  itkCloneMacro(x); \
315  ITK_MACROEND_NOOP_STATEMENT
316 
317 
318 #define itkSimpleNewMacro(x) \
319  static Pointer New() \
320  { \
321  Pointer smartPtr = ::itk::ObjectFactory<x>::Create(); \
322  if (smartPtr == nullptr) \
323  { \
324  smartPtr = new x; \
325  } \
326  smartPtr->UnRegister(); \
327  return smartPtr; \
328  } \
329  ITK_MACROEND_NOOP_STATEMENT
330 
331 #define itkCreateAnotherMacro(x) \
332  ::itk::LightObject::Pointer CreateAnother() const override \
333  { \
334  ::itk::LightObject::Pointer smartPtr; \
335  smartPtr = x::New().GetPointer(); \
336  return smartPtr; \
337  } \
338  ITK_MACROEND_NOOP_STATEMENT
339 
340 #define itkCloneMacro(x) \
341  Pointer Clone() const \
342  { \
343  Pointer rval = dynamic_cast<x *>(this->InternalClone().GetPointer()); \
344  return rval; \
345  } \
346  ITK_MACROEND_NOOP_STATEMENT
347 
360 #define itkFactorylessNewMacro(x) \
361  static Pointer New() \
362  { \
363  Pointer smartPtr; \
364  x * rawPtr = new x; \
365  smartPtr = rawPtr; \
366  rawPtr->UnRegister(); \
367  return smartPtr; \
368  } \
369  ::itk::LightObject::Pointer CreateAnother() const override \
370  { \
371  ::itk::LightObject::Pointer smartPtr; \
372  smartPtr = x::New().GetPointer(); \
373  return smartPtr; \
374  } \
375  ITK_MACROEND_NOOP_STATEMENT
376 
377 
378 //
379 // A macro to disallow the copy constructor, copy assignment,
380 // move constructor, and move assignment functions.
381 // This should be used in the public: declarations for a class
382 //
383 // ITK's paradigm for smart pointer and pipeline consistency
384 // prohibits the use of copy/move construction and copy/move assignment
385 // functions.
386 //
387 #define ITK_DISALLOW_COPY_AND_MOVE(TypeName) \
388  TypeName(const TypeName &) = delete; \
389  TypeName & operator=(const TypeName &) = delete; \
390  TypeName(TypeName &&) = delete; \
391  TypeName & operator=(TypeName &&) = delete
392 
393 #if !defined(ITK_FUTURE_LEGACY_REMOVE)
394 # define ITK_DISALLOW_COPY_AND_ASSIGN(TypeName) ITK_DISALLOW_COPY_AND_MOVE(TypeName)
395 #else
396 # define ITK_DISALLOW_COPY_AND_ASSIGN(TypeName) \
397  static_assert(false, "Replace deprecated ITK_DISALLOW_COPY_AND_ASSIGN with modern ITK_DISALLOW_COPY_AND_MOVE")
398 #endif
399 
402 #define itkTypeMacro(thisClass, superclass) \
403  const char * GetNameOfClass() const override { return #thisClass; } \
404  ITK_MACROEND_NOOP_STATEMENT
405 
406 #define itkTypeMacroNoParent(thisClass) \
407  virtual const char * GetNameOfClass() const { return #thisClass; } \
408  ITK_MACROEND_NOOP_STATEMENT
409 
410 namespace itk
411 {
418 extern ITKCommon_EXPORT void
419 OutputWindowDisplayText(const char *);
421 
422 extern ITKCommon_EXPORT void
423 OutputWindowDisplayErrorText(const char *);
424 
425 extern ITKCommon_EXPORT void
426 OutputWindowDisplayWarningText(const char *);
427 
428 extern ITKCommon_EXPORT void
429 OutputWindowDisplayGenericOutputText(const char *);
430 
431 extern ITKCommon_EXPORT void
432 OutputWindowDisplayDebugText(const char *);
433 } // end namespace itk
434 
435 // The itkDebugStatement is to be used to protect code that is only used in the itkDebugMacro
439 #if defined(NDEBUG)
440 # define itkDebugMacro(x) ITK_NOOP_STATEMENT
441 # define itkDebugStatement(x) ITK_NOOP_STATEMENT
442 #else
443 # define itkDebugMacro(x) \
444  do \
445  { \
446  if (this->GetDebug() && ::itk::Object::GetGlobalWarningDisplay()) \
447  { \
448  std::ostringstream itkmsg; \
449  itkmsg << "Debug: In " __FILE__ ", line " << __LINE__ << "\n" \
450  << this->GetNameOfClass() << " (" << this << "): " x << "\n\n"; \
451  ::itk::OutputWindowDisplayDebugText(itkmsg.str().c_str()); \
452  } \
453  } while (0)
454 
455 
456 // The itkDebugStatement is to be used to protect code that is only
457 // used in the itkDebugMacro
458 # define itkDebugStatement(x) x
459 #endif
460 
464 #define itkWarningMacro(x) \
465  do \
466  { \
467  if (::itk::Object::GetGlobalWarningDisplay()) \
468  { \
469  std::ostringstream itkmsg; \
470  itkmsg << "WARNING: In " __FILE__ ", line " << __LINE__ << "\n" \
471  << this->GetNameOfClass() << " (" << this << "): " x << "\n\n"; \
472  ::itk::OutputWindowDisplayWarningText(itkmsg.str().c_str()); \
473  } \
474  } while (0)
475 
476 
477 #define itkWarningStatement(x) x
478 
479 #if defined(ITK_CPP_FUNCTION)
480 # if defined(_WIN32) && !defined(__MINGW32__) && !defined(ITK_WRAPPING_PARSER)
481 # define ITK_LOCATION __FUNCSIG__
482 # elif defined(__GNUC__)
483 # define ITK_LOCATION __PRETTY_FUNCTION__
484 # else
485 # define ITK_LOCATION __FUNCTION__
486 # endif
487 #else
488 # define ITK_LOCATION "unknown"
489 #endif
490 
491 #define itkDeclareExceptionMacro(newexcp, parentexcp, whatmessage) \
492  namespace itk \
493  { \
494  class newexcp : public parentexcp \
495  { \
496  public: \
497  /* default message provides backward compatibility for a given exception type */ \
498  static constexpr const char * const default_exception_message = whatmessage; \
499  /* Inherit the constructors from its base class. */ \
500  using parentexcp::parentexcp; \
501  itkTypeMacro(newexcp, parentexcp); \
502  }; \
503  } \
504  ITK_MACROEND_NOOP_STATEMENT
505 
506 
507 #define itkSpecializedMessageExceptionMacro(ExceptionType, x) \
508  { \
509  std::ostringstream exceptionDescriptionOutputStringStream; \
510  exceptionDescriptionOutputStringStream << "ITK ERROR: " x; \
511  throw ::itk::ExceptionType( \
512  std::string{ __FILE__ }, __LINE__, exceptionDescriptionOutputStringStream.str(), std::string{ ITK_LOCATION }); \
513  } \
514  ITK_MACROEND_NOOP_STATEMENT
515 
516 #define itkSpecializedExceptionMacro(ExceptionType) \
517  itkSpecializedMessageExceptionMacro(ExceptionType, << ::itk::ExceptionType::default_exception_message)
518 
522 #define itkExceptionMacro(x) \
523  itkSpecializedMessageExceptionMacro(ExceptionObject, << this->GetNameOfClass() << "(" << this << "): " x)
524 
525 #define itkGenericExceptionMacro(x) itkSpecializedMessageExceptionMacro(ExceptionObject, x)
526 
527 #define itkGenericOutputMacro(x) \
528  { \
529  if (::itk::Object::GetGlobalWarningDisplay()) \
530  { \
531  std::ostringstream itkmsg; \
532  itkmsg << "WARNING: In " __FILE__ ", line " << __LINE__ << "\n" x << "\n\n"; \
533  ::itk::OutputWindowDisplayGenericOutputText(itkmsg.str().c_str()); \
534  } \
535  } \
536  ITK_MACROEND_NOOP_STATEMENT
537 
538 //----------------------------------------------------------------------------
539 // Macros for simplifying the use of logging
540 //
541 #define itkLogMacro(x, y) \
542  { \
543  if (this->GetLogger()) \
544  { \
545  this->GetLogger()->Write(::itk::LoggerBase::x, y); \
546  } \
547  } \
548  ITK_MACROEND_NOOP_STATEMENT
549 
550 #define itkLogMacroStatic(obj, x, y) \
551  { \
552  if (obj->GetLogger()) \
553  { \
554  obj->GetLogger()->Write(::itk::LoggerBase::x, y); \
555  } \
556  } \
557  ITK_MACROEND_NOOP_STATEMENT
558 
559 //----------------------------------------------------------------------------
560 // Setup legacy code policy.
561 //
562 // CMake options:
563 // - When ITK_LEGACY_REMOVE:BOOL=ON, legacy code is hidden, thus causing compiler errors for code that depends on it
564 // - When ITK_LEGACY_REMOVE:BOOL=OFF, and ITK_LEGACY_SILENT:BOOL=ON, use
565 // of legacy code will not produce compiler warnings.
566 // - When ITK_LEGACY_REMOVE:BOOL=OFF, and ITK_LEGACY_SILENT:BOOL=OFF, use
567 // of legacy code will produce compiler warnings
568 //
569 // ITK_LEGACY_SILENT silently use legacy code. The default is to warn about legacy code use.
570 //
571 // Source files that test the legacy code may define ITK_LEGACY_TEST
572 // like this:
573 //
574 // #define ITK_LEGACY_TEST
575 // #include "itkClassWithDeprecatedMethod.h"
576 //
577 // in order to silence the warnings for calling deprecated methods.
578 // No other source files in ITK should call the methods since they are
579 // provided only for compatibility with older user code.
580 
581 // Define itkLegacyMacro to mark legacy methods where they are
582 // declared in their class. Example usage:
583 //
584 // // \deprecated Replaced by MyOtherMethod() as of ITK 2.0.
585 // itkLegacyMacro(void MyMethod());
586 //
587 // See below for what to do for the method definition.
588 #if defined(ITK_LEGACY_REMOVE)
589 # define itkLegacyMacro(method) /* no ';' */
590 #else
591 # if defined(ITK_LEGACY_SILENT) || defined(ITK_LEGACY_TEST)
592 // Provide legacy methods with no warnings.
593 # define itkLegacyMacro(method) method
594 # else
595 // Setup compile-time warnings for uses of deprecated methods if
596 // possible on this compiler.
597 # if defined(__GNUC__) && !defined(__INTEL_COMPILER)
598 # define itkLegacyMacro(method) method __attribute__((deprecated))
599 # elif defined(_MSC_VER)
600 # define itkLegacyMacro(method) __declspec(deprecated) method
601 # else
602 # define itkLegacyMacro(method) method
603 # endif
604 # endif
605 #endif
606 
607 // Macros to create runtime deprecation warning messages in function
608 // bodies. Example usage:
609 //
610 // #if !defined( ITK_LEGACY_REMOVE )
611 // void itkMyClass::MyOldMethod()
612 // {
613 // itkLegacyBodyMacro(itkMyClass::MyOldMethod, 2.0);
614 // }
615 //
616 // void itkMyClass::MyMethod()
617 // {
618 // itkLegacyReplaceBodyMacro(itkMyClass::MyMethod, 2.0,
619 // itkMyClass::MyOtherMethod);
620 // }
621 // #endif
622 //
623 // NOTE: These 4 macros itkLegacyBodyMacro, itkLegacyReplaceBodyMacro,
624 // itkGenericLegacyBodyMacro, and itkGenericLegacyReplaceBodyMacro
625 // are purposefully not defined when ITK_LEGACY_REMOVE is on,
626 // because these macros are only relevant inside code segments
627 // that are conditionally compiled only when ITK_LEGACY_REMOVE
628 // is off.
629 #if defined(ITK_LEGACY_SILENT)
630 # define itkLegacyBodyMacro(method, version) ITK_NOOP_STATEMENT
631 # define itkLegacyReplaceBodyMacro(method, version, replace) ITK_NOOP_STATEMENT
632 # define itkGenericLegacyBodyMacro(method, version) ITK_NOOP_STATEMENT
633 # define itkGenericLegacyReplaceBodyMacro(method, version, replace) ITK_NOOP_STATEMENT
634 #else
635 # define itkLegacyBodyMacro(method, version) \
636  itkWarningMacro(#method " was deprecated for ITK " #version " and will be removed in a future version.")
637 # define itkLegacyReplaceBodyMacro(method, version, replace) \
638  itkWarningMacro(#method " was deprecated for ITK " #version \
639  " and will be removed in a future version. Use " #replace " instead.")
640 # define itkGenericLegacyBodyMacro(method, version) \
641  itkGenericOutputMacro(#method " was deprecated for ITK " #version " and will be removed in a future version.")
642 # define itkGenericLegacyReplaceBodyMacro(method, version, replace) \
643  itkGenericOutputMacro(#method " was deprecated for ITK " #version \
644  " and will be removed in a future version. Use " #replace " instead.")
645 #endif
646 
647 // Most modern x86 CPUs have 64 byte aligned blocks which are used for
648 // the cache lines. By aligning multi-threaded structures with the
649 // cache lines, false shared can be reduced, and performance
650 // increased.
651 #define ITK_CACHE_LINE_ALIGNMENT 64
652 
653 //
654 // itkPadStruct will add padding to a structure to ensure a minimum size
655 // for ensuring that adjacent structures do not share CACHE lines.
656 // Each struct will take up some multiple of cacheline sizes.
657 // This is particularly useful for arrays of thread private variables.
658 //
659 #define itkPadStruct(mincachesize, oldtype, newtype) \
660  struct newtype : public oldtype \
661  { \
662  char _StructPadding[mincachesize - (sizeof(oldtype) % mincachesize)]; \
663  };
664 
665 //
666 // itkAlignedTypedef is a macro which creates a new type to make a
667 // data structure aligned.
668 //
669 #if defined(ITK_HAS_GNU_ATTRIBUTE_ALIGNED)
670 # define itkAlignedTypedef(alignment, oldtype, newtype) using newtype = oldtype __attribute__((aligned(alignment)))
671 #elif defined(_MSC_VER)
672 # define itkAlignedTypedef(alignment, oldtype, newtype) using newtype = __declspec(align(alignment)) oldtype
673 #else
674 # define itkAlignedTypedef(alignment, oldtype, newtype) using newtype = oldtype
675 #endif
676 
677 #if defined(ITK_FUTURE_LEGACY_REMOVE)
678 //=============================================================================
679 /*
680 NOTE: DEPRECATED - This macro is not longer needed to support modern
681 compilers.
682 
683  Define a common way of declaring a templated function as a friend inside a class.
684  - ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENTS(T)
685 
686  The following templated function
687 
688  template <T>
689  T add(const T & a, const T & b);
690 
691  is declared as friend with
692 
693  class A
694  {
695  public:
696  friend Self add<>( const Self & a, const Self & b );
697  }
698 
699 */
700 # define ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT(T) < >
701 #else // LEGACY_REMOVE
702 # define ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT(T) "Macro remove use C++11 compliant declaration of "
703 #endif
704 
705 //--------------------------------------------------------------------------------
706 // Helper macros for Template Meta-Programming techniques of for-loops
707 // unrolling
708 //--------------------------------------------------------------------------------
709 
710 //--------------------------------------------------------------------------------
711 // Macro that generates an unrolled for loop for assigning elements of one array
712 // to elements of another array The array are assumed to be of same length
713 // (dimension), and this is also assumed to be the value of NumberOfIterations.
714 // No verification of size is performed. Casting is performed as part of the
715 // assignment, by using the DestinationElementType as the casting type.
716 // Source and destination array types must have defined operator[] in their
717 // API.
718 #define itkForLoopAssignmentMacro( \
719  DestinationType, SourceType, DestinationElementType, DestinationArray, SourceArray, NumberOfIterations) \
720  for (unsigned int i = 0; i < NumberOfIterations; ++i) \
721  { \
722  DestinationArray[i] = static_cast<DestinationElementType>(SourceArray[i]); \
723  }
724 
725 //--------------------------------------------------------------------------------
726 // Macro that generates an unrolled for loop for rounding and assigning
727 // elements of one array to elements of another array The array are assumed to
728 // be of same length (dimension), and this is also assumed to be the value of
729 // NumberOfIterations. No verification of size is performed. Casting is
730 // performed as part of the assignment, by using the DestinationElementType as
731 // the casting type.
732 // Source and destination array types must have defined operator[] in their
733 // API.
734 #define itkForLoopRoundingAndAssignmentMacro( \
735  DestinationType, Sourcrnd_halfintup, DestinationElementType, DestinationArray, SourceArray, NumberOfIterations) \
736  for (unsigned int i = 0; i < NumberOfIterations; ++i) \
737  { \
738  DestinationArray[i] = itk::Math::Round<DestinationElementType>(SourceArray[i]); \
739  }
740 
741 // end of Template Meta Programming helper macros
742 
743 #ifndef NDEBUG
744 
745 # ifdef _POSIX_SOURCE
746 # define itkAssertInDebugOrThrowInReleaseMacro(msg) __assert_fail(msg, __FILE__, __LINE__, __ASSERT_FUNCTION);
747 # else
748 # define itkAssertInDebugOrThrowInReleaseMacro(msg) itkGenericExceptionMacro(<< msg);
749 # endif
750 
751 #else
752 # define itkAssertInDebugOrThrowInReleaseMacro(msg) itkGenericExceptionMacro(<< msg);
753 #endif
754 
755 #define itkAssertOrThrowMacro(test, message) \
756  if (!(test)) \
757  { \
758  std::ostringstream msgstr; \
759  msgstr << message; \
760  itkAssertInDebugOrThrowInReleaseMacro(msgstr.str().c_str()); \
761  } \
762  ITK_MACROEND_NOOP_STATEMENT
763 
764 #ifndef NDEBUG
765 # define itkAssertInDebugAndIgnoreInReleaseMacro(X) assert(X)
766 #else
767 # define itkAssertInDebugAndIgnoreInReleaseMacro(X) ITK_NOOP_STATEMENT
768 #endif
769 
770 
771 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
772 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
773 // !! The ITK Get/Set Macros for various types !!
774 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
775 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
790 #define itkStaticConstMacro(name, type, value) static constexpr type name = value
791 
792 #define itkGetStaticConstMacro(name) (Self::name)
793 
795 #define itkSetInputMacro(name, type) \
796  virtual void Set##name(const type * _arg) \
797  { \
798  itkDebugMacro("setting input " #name " to " << _arg); \
799  if (_arg != itkDynamicCastInDebugMode<type *>(this->ProcessObject::GetInput(#name))) \
800  { \
801  this->ProcessObject::SetInput(#name, const_cast<type *>(_arg)); \
802  this->Modified(); \
803  } \
804  } \
805  ITK_MACROEND_NOOP_STATEMENT
806 
807 
809 #define itkGetInputMacro(name, type) \
810  virtual const type * Get##name() const \
811  { \
812  itkDebugMacro("returning input " << #name " of " << this->ProcessObject::GetInput(#name)); \
813  return itkDynamicCastInDebugMode<const type *>(this->ProcessObject::GetInput(#name)); \
814  } \
815  ITK_MACROEND_NOOP_STATEMENT
816 
817 
818 // clang-format off
820 #define itkSetDecoratedInputMacro(name, type) \
821  virtual void Set##name##Input(const SimpleDataObjectDecorator<type> * _arg) \
822  { \
823  itkDebugMacro("setting input " #name " to " << _arg); \
824  if (_arg != itkDynamicCastInDebugMode<SimpleDataObjectDecorator<type> *>(this->ProcessObject::GetInput(#name))) \
825  { \
826  this->ProcessObject::SetInput(#name, const_cast<SimpleDataObjectDecorator<type> *>(_arg)); \
827  this->Modified(); \
828  } \
829  } \
830  virtual void Set##name(const SimpleDataObjectDecorator<type> * _arg) { this->Set##name##Input(_arg); } \
831  virtual void Set##name(const type & _arg) \
832  { \
833  using DecoratorType = SimpleDataObjectDecorator<type>; \
834  itkDebugMacro("setting input " #name " to " << _arg); \
835  const DecoratorType * oldInput = \
836  itkDynamicCastInDebugMode<const DecoratorType *>(this->ProcessObject::GetInput(#name)); \
837  CLANG_PRAGMA_PUSH \
838  CLANG_SUPPRESS_Wfloat_equal \
839  if (oldInput && oldInput->Get() == _arg) \
840  { \
841  return; \
842  } \
843  CLANG_PRAGMA_POP \
844  typename DecoratorType::Pointer newInput = DecoratorType::New(); \
845  newInput->Set(_arg); \
846  this->Set##name##Input(newInput); \
847  } \
848  ITK_MACROEND_NOOP_STATEMENT
849 // clang-format on
851 
853 #define itkGetDecoratedInputMacro(name, type) \
854  virtual const SimpleDataObjectDecorator<type> * Get##name##Input() const \
855  { \
856  itkDebugMacro("returning input " << #name " of " << this->ProcessObject::GetInput(#name)); \
857  return itkDynamicCastInDebugMode<const SimpleDataObjectDecorator<type> *>(this->ProcessObject::GetInput(#name)); \
858  } \
859  virtual const type & Get##name() const \
860  { \
861  itkDebugMacro("Getting input " #name); \
862  using DecoratorType = SimpleDataObjectDecorator<type>; \
863  const DecoratorType * input = \
864  itkDynamicCastInDebugMode<const DecoratorType *>(this->ProcessObject::GetInput(#name)); \
865  if (input == nullptr) \
866  { \
867  itkExceptionMacro(<< "input" #name " is not set"); \
868  } \
869  return input->Get(); \
870  } \
871  ITK_MACROEND_NOOP_STATEMENT
872 
873 
876 #define itkSetGetDecoratedInputMacro(name, type) \
877  itkSetDecoratedInputMacro(name, type); \
878  itkGetDecoratedInputMacro(name, type)
879 
884 #define itkSetDecoratedObjectInputMacro(name, type) \
885  virtual void Set##name##Input(const DataObjectDecorator<type> * _arg) \
886  { \
887  itkDebugMacro("setting input " #name " to " << _arg); \
888  if (_arg != itkDynamicCastInDebugMode<DataObjectDecorator<type> *>(this->ProcessObject::GetInput(#name))) \
889  { \
890  this->ProcessObject::SetInput(#name, const_cast<DataObjectDecorator<type> *>(_arg)); \
891  this->Modified(); \
892  } \
893  } \
894  virtual void Set##name(const type * _arg) \
895  { \
896  using DecoratorType = DataObjectDecorator<type>; \
897  itkDebugMacro("setting input " #name " to " << _arg); \
898  const DecoratorType * oldInput = \
899  itkDynamicCastInDebugMode<const DecoratorType *>(this->ProcessObject::GetInput(#name)); \
900  if (oldInput && oldInput->Get() == _arg) \
901  { \
902  return; \
903  } \
904  typename DecoratorType::Pointer newInput = DecoratorType::New(); \
905  newInput->Set(_arg); \
906  this->Set##name##Input(newInput); \
907  } \
908  ITK_MACROEND_NOOP_STATEMENT
909 
910 
915 #define itkGetDecoratedObjectInputMacro(name, type) \
916  virtual const DataObjectDecorator<type> * Get##name##Input() const \
917  { \
918  itkDebugMacro("returning input " << #name " of " << this->ProcessObject::GetInput(#name)); \
919  return itkDynamicCastInDebugMode<const DataObjectDecorator<type> *>(this->ProcessObject::GetInput(#name)); \
920  } \
921  virtual const type * Get##name() const \
922  { \
923  itkDebugMacro("Getting input " #name); \
924  using DecoratorType = DataObjectDecorator<type>; \
925  const DecoratorType * input = \
926  itkDynamicCastInDebugMode<const DecoratorType *>(this->ProcessObject::GetInput(#name)); \
927  if (input == nullptr) \
928  { \
929  return nullptr; \
930  } \
931  return input->Get(); \
932  } \
933  ITK_MACROEND_NOOP_STATEMENT
934 
935 
938 #define itkSetGetDecoratedObjectInputMacro(name, type) \
939  itkSetDecoratedObjectInputMacro(name, type); \
940  itkGetDecoratedObjectInputMacro(name, type)
941 
943 // clang-format off
944 #define itkSetMacro(name, type) \
945  virtual void Set##name(const type _arg) \
946  { \
947  itkDebugMacro("setting " #name " to " << _arg); \
948  CLANG_PRAGMA_PUSH \
949  CLANG_SUPPRESS_Wfloat_equal \
950  if (this->m_##name != _arg) \
951  { \
952  this->m_##name = _arg; \
953  this->Modified(); \
954  } \
955  CLANG_PRAGMA_POP \
956  } \
957  ITK_MACROEND_NOOP_STATEMENT
958 // clang-format on
959 
961 #define itkGetMacro(name, type) \
962  virtual type Get##name() { return this->m_##name; } \
963  ITK_MACROEND_NOOP_STATEMENT
964 
965 
969 #define itkGetConstMacro(name, type) \
970  virtual type Get##name() const { return this->m_##name; } \
971  ITK_MACROEND_NOOP_STATEMENT
972 
973 
978 #define itkGetConstReferenceMacro(name, type) \
979  virtual const type & Get##name() const { return this->m_##name; } \
980  ITK_MACROEND_NOOP_STATEMENT
981 
982 
987 #define itkSetEnumMacro(name, type) \
988  virtual void Set##name(const type _arg) \
989  { \
990  itkDebugMacro("setting " #name " to " << static_cast<long>(_arg)); \
991  if (this->m_##name != _arg) \
992  { \
993  this->m_##name = _arg; \
994  this->Modified(); \
995  } \
996  } \
997  ITK_MACROEND_NOOP_STATEMENT
998 
999 
1004 #define itkGetEnumMacro(name, type) \
1005  virtual type Get##name() const { return this->m_##name; } \
1006  ITK_MACROEND_NOOP_STATEMENT
1007 
1008 
1012 #define itkSetStringMacro(name) \
1013  virtual void Set##name(const char * _arg) \
1014  { \
1015  if (_arg && (_arg == this->m_##name)) \
1016  { \
1017  return; \
1018  } \
1019  if (_arg) \
1020  { \
1021  this->m_##name = _arg; \
1022  } \
1023  else \
1024  { \
1025  this->m_##name = ""; \
1026  } \
1027  this->Modified(); \
1028  } \
1029  virtual void Set##name(const std::string & _arg) { this->Set##name(_arg.c_str()); } \
1030  ITK_MACROEND_NOOP_STATEMENT
1031 
1032 
1033 
1037 #define itkGetStringMacro(name) \
1038  virtual const char * Get##name() const { return this->m_##name.c_str(); } \
1039  ITK_MACROEND_NOOP_STATEMENT
1040 
1041 // clang-format off
1045 #define itkSetClampMacro(name, type, min, max) \
1046  virtual void Set##name(type _arg) \
1047  { \
1048  const type temp_extrema = (_arg < min ? min : (_arg > max ? max : _arg)); \
1049  itkDebugMacro("setting " << #name " to " << _arg); \
1050  CLANG_PRAGMA_PUSH \
1051  CLANG_SUPPRESS_Wfloat_equal \
1052  if (this->m_##name != temp_extrema) \
1053  { \
1054  this->m_##name = temp_extrema; \
1055  this->Modified(); \
1056  } \
1057  CLANG_PRAGMA_POP \
1058  } \
1059  ITK_MACROEND_NOOP_STATEMENT
1060 // clang-format on
1062 
1063 // clang-format off
1064 // NOTE: warning: comparing floating point with == or != is unsafe [-Wfloat-equal]
1069 #define itkSetObjectMacro(name, type) \
1070  virtual void Set##name(type * _arg) \
1071  { \
1072  itkDebugMacro("setting " << #name " to " << _arg); \
1073  CLANG_PRAGMA_PUSH \
1074  CLANG_SUPPRESS_Wfloat_equal \
1075  if (this->m_##name != _arg) \
1076  { \
1077  this->m_##name = _arg; \
1078  this->Modified(); \
1079  } \
1080  CLANG_PRAGMA_POP \
1081  } \
1082  ITK_MACROEND_NOOP_STATEMENT
1083 // clang-format on
1085 
1094 // NOTE: A class can use either itkGetModifiableObjectMacro
1095 // or itkGetObjectMacro, but not both.
1096 // A class can use either itkGetModifiableObjectMacro
1097 // or itkGetConstObjectMacro, but not both.
1098 // If the desired behavior is to only provide const
1099 // access to the itkObject ivar, then use itkGetConstObjectMacro,
1100 // else use itkGetModifiableObjectMacro for read/write access to
1101 // the ivar.
1102 // It is permissible to use both itkGetObjectMacro and itkGetConstObjectMacro
1103 // for backwards compatibility.
1104 // If the ITK_LEGACY_REMOVE=FALSE, then it is
1105 // permissible to use itkGetObjectMacro which
1106 // defines both signatures itk::GetXXX() and
1107 // itk::GetModifiableXXX()
1108 
1111 #define itkGetConstObjectMacro(name, type) \
1112  virtual const type * Get##name() const { return this->m_##name.GetPointer(); } \
1113  ITK_MACROEND_NOOP_STATEMENT
1114 
1115 
1116 #if defined(ITK_FUTURE_LEGACY_REMOVE)
1117 // In the future, the itkGetObjectMacro will be deprecated with the ITK_LEGACY_REMOVE
1118 // flag. For now, this very advanced feature is only available
1119 // through manual setting of a compiler define -DITK_FUTURE_LEGACY_REMOVE
1120 // ("/DITK_FUTURE_LEGACY_REMOVE /EHsc" with Visual Studio)
1121 // to ease the transition from the historical GetObjectMacro to the GetModifiableObjectMacro
1122 # define itkGetObjectMacro(name, type) \
1123  virtual type * Get##name() \
1124  { \
1125  purposeful_error("itkGetObjectMacro should be replaced with itkGetModifiableObjectMacro."); \
1126  }
1127 
1128 # define itkGetModifiableObjectMacro(name, type) \
1129  virtual type * GetModifiable##name() { return this->m_##name.GetPointer(); } \
1130  itkGetConstObjectMacro(name, type)
1131 
1132 #else // defined ( ITK_FUTURE_LEGACY_REMOVE )
1133 
1135 # define itkGetObjectMacro(name, type) \
1136  virtual type * Get##name() { return this->m_##name.GetPointer(); } \
1137  ITK_MACROEND_NOOP_STATEMENT
1138 # define itkGetModifiableObjectMacro(name, type) \
1139  virtual type * GetModifiable##name() { return this->m_##name.GetPointer(); } \
1140  itkGetConstObjectMacro(name, type); \
1141  itkGetObjectMacro(name, type)
1142 #endif // defined ( ITK_FUTURE_LEGACY_REMOVE )
1143 
1144 
1145 // For backwards compatibility define ITK_EXPORT to nothing
1146 #define ITK_EXPORT
1147 
1148 
1151 #define itkGetConstReferenceObjectMacro(name, type) \
1152  virtual const typename type::Pointer & Get##name() const { return this->m_##name; } \
1153  ITK_MACROEND_NOOP_STATEMENT
1154 
1159 #define itkSetConstObjectMacro(name, type) \
1160  virtual void Set##name(const type * _arg) \
1161  { \
1162  itkDebugMacro("setting " << #name " to " << _arg); \
1163  if (this->m_##name != _arg) \
1164  { \
1165  this->m_##name = _arg; \
1166  this->Modified(); \
1167  } \
1168  } \
1169  ITK_MACROEND_NOOP_STATEMENT
1170 
1171 
1174 #define itkBooleanMacro(name) \
1175  virtual void name##On() { this->Set##name(true); } \
1176  virtual void name##Off() { this->Set##name(false); }
1177 
1178 
1179 // clang-format off
1183 #define itkSetVectorMacro(name, type, count) \
1184  virtual void Set##name(type data[]) \
1185  { \
1186  unsigned int i; \
1187  for (i = 0; i < count; i++) \
1188  { \
1189  CLANG_PRAGMA_PUSH \
1190  CLANG_SUPPRESS_Wfloat_equal \
1191  if (data[i] != this->m_##name[i]) \
1192  { \
1193  break; \
1194  } \
1195  CLANG_PRAGMA_POP \
1196  } \
1197  if (i < count) \
1198  { \
1199  this->Modified(); \
1200  for (i = 0; i < count; i++) \
1201  { \
1202  this->m_##name[i] = data[i]; \
1203  } \
1204  } \
1205  } \
1206  ITK_MACROEND_NOOP_STATEMENT
1207 // clang-format on
1209 
1212 #define itkGetVectorMacro(name, type, count) \
1213  virtual type * Get##name() const { return this->m_##name; } \
1214  ITK_MACROEND_NOOP_STATEMENT
1215 
1220 #define itkGPUKernelClassMacro(kernel) class itkGPUKernelMacro(kernel)
1221 
1227 #define itkGPUKernelMacro(kernel) \
1228  kernel \
1229  { \
1230  public: \
1231  ITK_DISALLOW_COPY_AND_MOVE(kernel); \
1232  kernel() = delete; \
1233  ~kernel() = delete; \
1234  static const char * GetOpenCLSource(); \
1235  }
1236 
1237 
1238 #define itkGetOpenCLSourceFromKernelMacro(kernel) \
1239  static const char * GetOpenCLSource() { return kernel::GetOpenCLSource(); }
1240 
1241 // A useful macro in the PrintSelf method for printing member variables
1242 // which are pointers to object based on the LightObject class.
1243 #define itkPrintSelfObjectMacro(name) \
1244  if (static_cast<const LightObject *>(this->m_##name) == nullptr) \
1245  { \
1246  os << indent << #name << ": (null)" << std::endl; \
1247  } \
1248  else \
1249  { \
1250  os << indent << #name << ": " << std::endl; \
1251  this->m_##name->Print(os, indent.GetNextIndent()); \
1252  } \
1253  ITK_MACROEND_NOOP_STATEMENT
1254 
1255 
1257 #define itkSetDecoratedOutputMacro(name, type) \
1258  virtual void Set##name##Output(const SimpleDataObjectDecorator<type> * _arg) \
1259  { \
1260  itkDebugMacro("setting output " #name " to " << _arg); \
1261  if (_arg != itkDynamicCastInDebugMode<SimpleDataObjectDecorator<type> *>(this->ProcessObject::GetOutput(#name))) \
1262  { \
1263  this->ProcessObject::SetOutput(#name, const_cast<SimpleDataObjectDecorator<type> *>(_arg)); \
1264  this->Modified(); \
1265  } \
1266  } \
1267  virtual void Set##name(const type & _arg) \
1268  { \
1269  using DecoratorType = SimpleDataObjectDecorator<type>; \
1270  itkDebugMacro("setting output " #name " to " << _arg); \
1271  DecoratorType * output = itkDynamicCastInDebugMode<DecoratorType *>(this->ProcessObject::GetOutput(#name)); \
1272  if (output) \
1273  { \
1274  if (output->Get() == _arg) \
1275  { \
1276  return; \
1277  } \
1278  else \
1279  { \
1280  output->Set(_arg); \
1281  } \
1282  } \
1283  else \
1284  { \
1285  typename DecoratorType::Pointer newOutput = DecoratorType::New(); \
1286  newOutput->Set(_arg); \
1287  this->Set##name##Output(newOutput); \
1288  } \
1289  } \
1290  ITK_MACROEND_NOOP_STATEMENT
1291 
1292 
1294 #define itkGetDecoratedOutputMacro(name, type) \
1295  virtual const SimpleDataObjectDecorator<type> * Get##name##Output() const \
1296  { \
1297  itkDebugMacro("returning output " << #name " of " << this->ProcessObject::GetOutput(#name)); \
1298  return itkDynamicCastInDebugMode<const SimpleDataObjectDecorator<type> *>(this->ProcessObject::GetOutput(#name)); \
1299  } \
1300  virtual const type & Get##name() const \
1301  { \
1302  itkDebugMacro("Getting output " #name); \
1303  using DecoratorType = SimpleDataObjectDecorator<type>; \
1304  const DecoratorType * output = \
1305  itkDynamicCastInDebugMode<const DecoratorType *>(this->ProcessObject::GetOutput(#name)); \
1306  if (output == nullptr) \
1307  { \
1308  itkExceptionMacro(<< "output" #name " is not set"); \
1309  } \
1310  return output->Get(); \
1311  } \
1312  ITK_MACROEND_NOOP_STATEMENT
1313 
1314 
1315 
1325 #if defined(ITKV4_COMPATIBILITY)
1326 # define ITK_ITERATOR_VIRTUAL virtual
1327 # define ITK_ITERATOR_OVERRIDE override
1328 # define ITK_ITERATOR_FINAL
1329 #elif !defined(ITK_LEGACY_REMOVE)
1330 # define ITK_ITERATOR_VIRTUAL virtual
1331 # define ITK_ITERATOR_OVERRIDE override
1332 # define ITK_ITERATOR_FINAL final
1333 #else
1334 # define ITK_ITERATOR_VIRTUAL
1335 # define ITK_ITERATOR_OVERRIDE
1336 # define ITK_ITERATOR_FINAL
1337 #endif
1338 
1339 #if defined(ITKV4_COMPATIBILITY)
1340 // A macro for methods which are const in ITKv5, but not in ITKv4
1341 # define ITKv5_CONST
1342 #else
1343 // A macro for methods which are const in ITKv5, but not in ITKv4
1344 # define ITKv5_CONST const
1345 #endif
1346 
1347 #define itkExceptionObject_h
1348 #include "itkExceptionObject.h"
1349 #undef itkExceptionObject_h
1350 
itkExceptionObject.h
itkWin32Header.h
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24