42 #include "itkConfigure.h"
43 #include "ITKCommonExport.h"
72 #define ITK_PRAGMA(x) _Pragma (#x)
78 #if defined(__clang__) && defined(__has_warning)
79 #define CLANG_PRAGMA_PUSH ITK_PRAGMA(clang diagnostic push)
80 #define CLANG_PRAGMA_POP ITK_PRAGMA(clang diagnostic pop)
81 # if __has_warning("-Wfloat-equal")
82 #define CLANG_SUPPRESS_Wfloat_equal ITK_PRAGMA( clang diagnostic ignored "-Wfloat-equal" )
85 #define CLANG_PRAGMA_PUSH
86 #define CLANG_PRAGMA_POP
87 #define CLANG_SUPPRESS_Wfloat_equal
96 #if defined( __GNUC__ ) && !defined( __INTEL_COMPILER )
97 # if ( __GNUC__ > 4 ) || (( __GNUC__ >= 4 ) && ( __GNUC_MINOR__ >= 2 ))
98 # define ITK_GCC_PRAGMA_DIAG(x) ITK_PRAGMA(GCC diagnostic x)
100 # define ITK_GCC_PRAGMA_DIAG(x)
103 # define ITK_GCC_PRAGMA_DIAG(x)
115 #if defined( __GNUC__ ) && !defined( __INTEL_COMPILER )
116 # if ( __GNUC__ > 4 ) || (( __GNUC__ >= 4 ) && ( __GNUC_MINOR__ >= 6 ))
117 # define ITK_GCC_PRAGMA_DIAG_PUSH() ITK_GCC_PRAGMA_DIAG(push)
118 # define ITK_GCC_PRAGMA_DIAG_POP() ITK_GCC_PRAGMA_DIAG(pop)
119 # define ITK_HAS_GCC_PRAGMA_DIAG_PUSHPOP
121 # define ITK_GCC_PRAGMA_DIAG_PUSH()
122 # define ITK_GCC_PRAGMA_DIAG_POP()
125 # define ITK_GCC_PRAGMA_DIAG_PUSH()
126 # define ITK_GCC_PRAGMA_DIAG_POP()
140 #if defined( _MSC_VER ) && ( _MSC_VER < 1310 )
143 #if defined( __SUNPRO_CC ) && ( __SUNPRO_CC < 0x590 )
144 #error "__SUNPRO_CC < 0x590 not supported under ITKv4"
146 #if defined( __CYGWIN__ )
147 #error "The Cygwin compiler is not supported in ITKv4 and above"
149 #if defined( __BORLANDC__ )
150 #error "The Borland C compiler is not supported in ITKv4 and above"
152 #if defined( __MWERKS__ )
153 #error "The MetroWerks compiler is not supported in ITKv4 and above"
155 #if defined( __GNUC__ ) && ( __GNUC__ < 3 )
156 #error "The __GNUC__ version 2.95 compiler is not supprted under ITKv4 and above"
161 #error "The __sgi compiler is not supprted under ITKv4 and above"
166 #if defined( _WIN32 ) || defined ( WIN32 )
167 #define ITK_ABI_IMPORT __declspec(dllimport)
168 #define ITK_ABI_EXPORT __declspec(dllexport)
169 #define ITK_ABI_HIDDEN
172 #define ITK_ABI_IMPORT __attribute__ ((visibility ("default")))
173 #define ITK_ABI_EXPORT __attribute__ ((visibility ("default")))
174 #define ITK_ABI_HIDDEN __attribute__ ((visibility ("hidden")))
176 #define ITK_ABI_IMPORT
177 #define ITK_ABI_EXPORT
178 #define ITK_ABI_HIDDEN
183 #ifndef ITK_TEMPLATE_EXPORT
184 #ifdef ITK_TEMPLATE_VISIBILITY_DEFAULT
185 #define ITK_TEMPLATE_EXPORT __attribute__ ((visibility ("default")))
187 #define ITK_TEMPLATE_EXPORT
192 #ifdef ITK_TEMPLATE_VISIBILITY_DEFAULT
193 #define ITK_FORCE_EXPORT_MACRO(moduleName) __attribute__ ((visibility ("default")))
195 #define ITK_FORCE_EXPORT_MACRO(moduleName) moduleName ## _EXPORT
198 #ifndef ITK_FORWARD_EXPORT
200 #if defined(__APPLE__)\
201 && defined(ITK_TEMPLATE_VISIBILITY_DEFAULT)\
202 && defined(ITK_BUILD_SHARED_LIBS)\
203 && defined(USE_COMPILER_HIDDEN_VISIBILITY)
204 #define ITK_FORWARD_EXPORT __attribute__ ((visibility ("default")))
206 #define ITK_FORWARD_EXPORT
210 #if ITK_COMPILED_CXX_STANDARD_VERSION >= 201103L
211 #define ITK_HAS_CXX11_RVREF
214 #if ! defined( ITK_FUTURE_LEGACY_REMOVE )
215 #if ITK_COMPILER_CXX_STATIC_ASSERT
216 #define ITK_HAS_CXX11_STATIC_ASSERT //NOTE DEPRECATED! should be ITK_COMPILER_CXX_STATIC_ASSERT
219 #if ITK_COMPILER_CXX_DELETED_FUNCTIONS
220 #define ITK_DELETE_FUNCTION =delete //NOTE DEPRECATED! should be ITK_DELETED_FUNCTION
222 #define ITK_DELETE_FUNCTION
225 #if ITK_COMPILER_CXX_ALIGNAS
227 #define ITK_HAS_CPP11_ALIGNAS
229 #ifdef ITK_HAS_CPP11_ALIGNAS
230 #undef ITK_HAS_CPP11_ALIGNAS
233 #if ITK_COMPILER_CXX_NOEXCEPT // NOTE DEPRECATED! Kept for backwards compatibility.
240 #define ITK_NOEXCEPT_OR_THROW() noexcept
242 #define ITK_NOEXCEPT_OR_THROW() throw()
246 #define ITK_NOEXCEPT_OR_THROW error "Replace ITK_NOEXCEPT_OR_THROW with ITK_NOEXCEPT"
248 #define ITK_HAS_CXX11_STATIC_ASSERT error "Replace ITK_HAS_CXX11_STATIC_ASSERT with ITK_COMPILER_CXX_STATIC_ASSERT"
250 #define ITK_DELETE_FUNCTION error "Replace ITK_DELETE_FUNCTION with ITK_DELETED_FUNCTION"
252 #define ITK_HAS_CPP11_ALIGNAS error "Replace ITK_HAS_CPP11_ALIGNAS with ITK_COMPILER_CXX_ALIGNAS"
256 #if ITK_COMPILER_CXX_CONSTEXPR
257 #define ITK_CONSTEXPR_FUNC constexpr
258 #define ITK_CONSTEXPR_VAR constexpr
260 #define ITK_CONSTEXPR_FUNC inline
261 #define ITK_CONSTEXPR_VAR const
266 #if defined( __GNUC__ ) && !defined( __INTEL_COMPILER )
267 # if ( __GNUC__ >= 7 )
268 # define ITK_FALLTHROUGH __attribute__((fallthrough))
270 #elif ITK_COMPILED_CXX_STANDARD_VERSION >= 201103L && defined(__has_warning)
271 # if __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough")
272 # define ITK_FALLTHROUGH [[clang::fallthrough]]
276 #ifndef ITK_FALLTHROUGH
277 # define ITK_FALLTHROUGH ((void)0)
300 #define itkNewMacro(x) \
301 itkSimpleNewMacro(x) \
302 itkCreateAnotherMacro(x) \
305 #define itkSimpleNewMacro(x) \
306 static Pointer New(void) \
308 Pointer smartPtr = ::itk::ObjectFactory< x >::Create(); \
309 if ( smartPtr.GetPointer() == ITK_NULLPTR ) \
313 smartPtr->UnRegister(); \
317 #define itkCreateAnotherMacro(x) \
318 virtual ::itk::LightObject::Pointer CreateAnother(void) const ITK_OVERRIDE \
320 ::itk::LightObject::Pointer smartPtr; \
321 smartPtr = x::New().GetPointer(); \
325 #define itkCloneMacro(x) \
326 Pointer Clone() const \
329 dynamic_cast<x *>(this->InternalClone().GetPointer()); \
345 #define itkFactorylessNewMacro(x) \
346 static Pointer New(void) \
349 x * rawPtr = new x; \
351 rawPtr->UnRegister(); \
354 virtual ::itk::LightObject::Pointer CreateAnother(void) const ITK_OVERRIDE \
356 ::itk::LightObject::Pointer smartPtr; \
357 smartPtr = x::New().GetPointer(); \
369 #define ITK_DISALLOW_COPY_AND_ASSIGN(TypeName) \
370 TypeName(const TypeName&) ITK_DELETED_FUNCTION; \
371 void operator=(const TypeName&) ITK_DELETED_FUNCTION
375 #define itkTypeMacro(thisClass, superclass) \
376 virtual const char *GetNameOfClass() const ITK_OVERRIDE \
381 #define itkTypeMacroNoParent(thisClass) \
382 virtual const char *GetNameOfClass() const \
395 extern ITKCommon_EXPORT
void OutputWindowDisplayText(
const char *);
398 extern ITKCommon_EXPORT
void OutputWindowDisplayErrorText(
const char *);
400 extern ITKCommon_EXPORT
void OutputWindowDisplayWarningText(
const char *);
402 extern ITKCommon_EXPORT
void OutputWindowDisplayGenericOutputText(
const char *);
404 extern ITKCommon_EXPORT
void OutputWindowDisplayDebugText(
const char *);
410 #if defined( NDEBUG )
411 #define itkDebugMacro(x)
412 #define itkDebugStatement(x)
414 #define itkDebugMacro(x) \
416 if ( this->GetDebug() && ::itk::Object::GetGlobalWarningDisplay() ) \
418 std::ostringstream itkmsg; \
419 itkmsg << "Debug: In " __FILE__ ", line " << __LINE__ << "\n" \
420 << this->GetNameOfClass() << " (" << this << "): " x \
422 ::itk::OutputWindowDisplayDebugText( itkmsg.str().c_str() ); \
429 #define itkDebugStatement(x) x
435 #define itkWarningMacro(x) \
437 if ( ::itk::Object::GetGlobalWarningDisplay() ) \
439 std::ostringstream itkmsg; \
440 itkmsg << "WARNING: In " __FILE__ ", line " << __LINE__ << "\n" \
441 << this->GetNameOfClass() << " (" << this << "): " x \
443 ::itk::OutputWindowDisplayWarningText( itkmsg.str().c_str() ); \
450 #define itkWarningStatement(x) x
452 #if defined( ITK_CPP_FUNCTION )
453 #if defined( _WIN32 ) && !defined( __MINGW32__ ) && !defined( ITK_WRAPPING_PARSER )
454 #define ITK_LOCATION __FUNCSIG__
455 #elif defined( __GNUC__ )
456 #define ITK_LOCATION __PRETTY_FUNCTION__
458 #define ITK_LOCATION __FUNCTION__
461 #define ITK_LOCATION "unknown"
469 #define itkExceptionMacro(x) \
471 std::ostringstream message; \
472 message << "itk::ERROR: " << this->GetNameOfClass() \
473 << "(" << this << "): " x; \
474 ::itk::ExceptionObject e_(__FILE__, __LINE__, message.str().c_str(), ITK_LOCATION); \
479 #define itkGenericExceptionMacro(x) \
481 std::ostringstream message; \
482 message << "itk::ERROR: " x; \
483 ::itk::ExceptionObject e_(__FILE__, __LINE__, message.str().c_str(), ITK_LOCATION); \
487 #define itkDeclareExceptionMacro(newexcp,parentexcp,whatmessage) \
489 class newexcp : public parentexcp \
492 newexcp( const char *file, unsigned int lineNumber ) : \
493 parentexcp( file, lineNumber ) \
495 this->SetDescription( whatmessage ); \
497 newexcp( const std::string & file, unsigned int lineNumber ) : \
498 parentexcp( file, lineNumber ) \
500 this->SetDescription( whatmessage ); \
502 itkTypeMacro(newexcp, parentexcp); \
506 #define itkSpecializedExceptionMacro(exceptiontype) \
508 ::itk::exceptiontype e_(__FILE__, __LINE__); \
509 e_.SetLocation(ITK_LOCATION); \
513 #define itkSpecializedMessageExceptionMacro(exceptiontype,x) \
515 ::itk::exceptiontype e_(__FILE__, __LINE__); \
516 std::ostringstream message; \
517 message << "itk::ERROR: " x; \
518 e_.SetDescription(message.str().c_str()); \
519 e_.SetLocation(ITK_LOCATION); \
524 #define itkGenericOutputMacro(x) \
526 if ( ::itk::Object::GetGlobalWarningDisplay() ) \
528 std::ostringstream itkmsg; \
529 itkmsg << "WARNING: In " __FILE__ ", line " << __LINE__ << "\n" \
531 ::itk::OutputWindowDisplayGenericOutputText( itkmsg.str().c_str() ); \
538 #define itkLogMacro(x, y) \
540 if ( this->GetLogger() ) \
542 this->GetLogger()->Write(::itk::LoggerBase::x, y); \
546 #define itkLogMacroStatic(obj, x, y) \
548 if ( obj->GetLogger() ) \
550 obj->GetLogger()->Write(::itk::LoggerBase::x, y); \
578 #if defined( ITK_LEGACY_REMOVE )
579 #define itkLegacyMacro(method)
580 #elif defined( ITK_LEGACY_SILENT ) || defined( ITK_LEGACY_TEST ) || defined( ITK_WRAPPING_PARSER )
582 #define itkLegacyMacro(method) method
586 #if defined( __GNUC__ ) && !defined( __INTEL_COMPILER ) && ( __GNUC__ > 3 || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 1 ) )
587 #define itkLegacyMacro(method) method __attribute__( ( deprecated ) )
588 #elif defined( _MSC_VER )
589 #define itkLegacyMacro(method) __declspec(deprecated) method
591 #define itkLegacyMacro(method) method
610 #if defined( ITK_LEGACY_REMOVE ) || defined( ITK_LEGACY_SILENT )
611 #define itkLegacyBodyMacro(method, version)
612 #define itkLegacyReplaceBodyMacro(method, version, replace)
613 #define itkGenericLegacyBodyMacro(method, version)
614 #define itkGenericLegacyReplaceBodyMacro(method, version, replace)
616 #define itkLegacyBodyMacro(method, version) \
617 itkWarningMacro(#method " was deprecated for ITK " #version " and will be removed in a future version.")
618 #define itkLegacyReplaceBodyMacro(method, version, replace) \
620 #method " was deprecated for ITK " #version " and will be removed in a future version. Use " #replace \
622 #define itkGenericLegacyBodyMacro(method, version) \
623 itkGenericOutputMacro(#method " was deprecated for ITK " #version " and will be removed in a future version.")
624 #define itkGenericLegacyReplaceBodyMacro(method, version, replace) \
625 itkGenericOutputMacro( \
626 #method " was deprecated for ITK " #version " and will be removed in a future version. Use " #replace \
630 #if defined ( ITK_LEGACY_REMOVE )
631 #define ITK_TEMPLATE_TXX "error ITK_TEMPLATE_TXX is no longer a supported identifier, you should replace with ITK_MANUAL_INSTANTIATION as a replacement"
633 #define ITK_TEMPLATE_TXX 1
641 #define ITK_CACHE_LINE_ALIGNMENT 64
649 #define itkPadStruct( mincachesize, oldtype, newtype ) \
650 struct newtype: public oldtype \
652 char _StructPadding[mincachesize - (sizeof(oldtype)%mincachesize) ]; \
659 #if defined( ITK_HAS_GNU_ATTRIBUTE_ALIGNED )
660 # define itkAlignedTypedef( alignment, oldtype, newtype ) \
661 typedef oldtype newtype __attribute__((aligned(alignment)))
662 #elif defined ( _MSC_VER )
663 # define itkAlignedTypedef( alignment, oldtype, newtype ) \
664 typedef __declspec(align( alignment )) oldtype newtype
666 # define itkAlignedTypedef( alignment, oldtype, newtype ) \
667 typedef oldtype newtype
699 #if defined( ITK_SUPPORTS_TEMPLATED_FRIEND_FUNCTION_WITH_NULL_STRING )
700 #define ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT(T)
702 #if defined( ITK_SUPPORTS_TEMPLATED_FRIEND_FUNCTION_WITH_EMPTY_BRACKETS )
703 #define ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT(T) < >
705 #if defined( ITK_SUPPORTS_TEMPLATED_FRIEND_FUNCTION_WITH_TEMPLATE_ARGUMENTS )
706 #define ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT(T) < T >
712 #if ( defined ( _MSC_VER ) && ( _MSC_VER >= 1600 ) )
713 #ifdef ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT
714 #undef ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT
716 #define ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT(T)
732 #define itkForLoopAssignmentMacro(DestinationType, \
734 DestinationElementType, \
737 NumberOfIterations) \
738 for ( unsigned int i = 0; i < NumberOfIterations; ++i ) \
740 DestinationArray[i] = static_cast< DestinationElementType >( SourceArray[i] ); \
752 #define itkForLoopRoundingAndAssignmentMacro(DestinationType, \
753 Sourcrnd_halfintup, \
754 DestinationElementType, \
757 NumberOfIterations) \
758 for ( unsigned int i = 0; i < NumberOfIterations; ++i ) \
760 DestinationArray[i] = itk::Math::Round< DestinationElementType >(SourceArray[i]); \
768 #define itkAssertInDebugOrThrowInReleaseMacro(msg) __assert_fail (msg, __FILE__, __LINE__, __ASSERT_FUNCTION);
770 #define itkAssertInDebugOrThrowInReleaseMacro(msg) itkGenericExceptionMacro(<< msg);
774 #define itkAssertInDebugOrThrowInReleaseMacro(msg) itkGenericExceptionMacro(<< msg);
777 #define itkAssertOrThrowMacro(test, message) \
780 std::ostringstream msgstr; \
782 itkAssertInDebugOrThrowInReleaseMacro( msgstr.str().c_str() ); \
786 #define itkAssertInDebugAndIgnoreInReleaseMacro(X) assert(X)
788 #define itkAssertInDebugAndIgnoreInReleaseMacro(X)
791 #ifdef ITKV3_COMPATIBILITY
795 #define ITK_TYPENAME typename
801 template <
typename TTarget,
typename TSource>
802 TTarget itkDynamicCastInDebugMode(TSource x)
809 TTarget rval =
dynamic_cast<TTarget
>(x);
812 itkGenericExceptionMacro(<<
"Failed dynamic cast to "
813 <<
typeid(TTarget).name()
815 << x->GetNameOfClass());
819 return static_cast<TTarget
>(x);
843 #if defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__ ) < 405 && !defined( __clang__ ) && !defined( __INTEL_COMPILER )
844 # define itkStaticConstMacro(name,type,value) enum { name = value }
846 # define itkStaticConstMacro(name,type,value) static ITK_CONSTEXPR_VAR type name = value
849 #define itkGetStaticConstMacro(name) (Self::name)
852 #define itkSetInputMacro(name, type) \
853 virtual void Set##name(const type *_arg) \
855 itkDebugMacro("setting input " #name " to " << _arg); \
856 if ( _arg != itkDynamicCastInDebugMode< type * >( this->ProcessObject::GetInput(#name) ) ) \
858 this->ProcessObject::SetInput( #name, const_cast< type * >( _arg ) ); \
865 #define itkGetInputMacro(name, type) \
866 virtual const type * Get##name() const \
868 itkDebugMacro( "returning input " << #name " of " << this->ProcessObject::GetInput(#name) ); \
869 return itkDynamicCastInDebugMode< const type * >( this->ProcessObject::GetInput(#name) ); \
874 #define itkSetDecoratedInputMacro(name, type) \
875 virtual void Set##name##Input(const SimpleDataObjectDecorator< type > *_arg) \
877 itkDebugMacro("setting input " #name " to " << _arg); \
878 if ( _arg != itkDynamicCastInDebugMode< SimpleDataObjectDecorator< type > * >( this->ProcessObject::GetInput(#name) ) ) \
880 this->ProcessObject::SetInput( #name, const_cast< SimpleDataObjectDecorator< type > * >( _arg ) ); \
884 virtual void Set##name(const SimpleDataObjectDecorator< type > *_arg) \
886 this->Set##name##Input(_arg); \
888 virtual void Set##name(const type &_arg) \
890 typedef SimpleDataObjectDecorator< type > DecoratorType; \
891 itkDebugMacro("setting input " #name " to " << _arg); \
892 const DecoratorType *oldInput = \
893 itkDynamicCastInDebugMode< const DecoratorType * >( \
894 this->ProcessObject::GetInput(#name) ); \
896 CLANG_SUPPRESS_Wfloat_equal \
897 if ( oldInput && oldInput->Get() == _arg ) \
902 typename DecoratorType::Pointer newInput = DecoratorType::New(); \
903 newInput->Set(_arg); \
904 this->Set##name##Input(newInput); \
909 #define itkGetDecoratedInputMacro(name, type) \
910 virtual const SimpleDataObjectDecorator< type > * Get##name##Input() const \
912 itkDebugMacro( "returning input " << #name " of " << this->ProcessObject::GetInput(#name) ); \
913 return itkDynamicCastInDebugMode< const SimpleDataObjectDecorator< type > * >( this->ProcessObject::GetInput(#name) ); \
915 virtual const type & Get##name() const \
917 itkDebugMacro("Getting input " #name); \
918 typedef SimpleDataObjectDecorator< type > DecoratorType; \
919 const DecoratorType *input = \
920 itkDynamicCastInDebugMode< const DecoratorType * >( \
921 this->ProcessObject::GetInput(#name) ); \
922 if( input == ITK_NULLPTR ) \
924 itkExceptionMacro(<<"input" #name " is not set"); \
926 return input->Get(); \
932 #define itkSetGetDecoratedInputMacro(name, type) \
933 itkSetDecoratedInputMacro(name, type) \
934 itkGetDecoratedInputMacro(name, type)
940 #define itkSetDecoratedObjectInputMacro(name, type) \
941 virtual void Set##name##Input(const DataObjectDecorator< type > *_arg) \
943 itkDebugMacro("setting input " #name " to " << _arg); \
944 if ( _arg != itkDynamicCastInDebugMode< DataObjectDecorator< type > * >( this->ProcessObject::GetInput(#name) ) ) \
946 this->ProcessObject::SetInput( #name, const_cast< DataObjectDecorator< type > * >( _arg ) ); \
950 virtual void Set##name(const type * _arg) \
952 typedef DataObjectDecorator< type > DecoratorType; \
953 itkDebugMacro("setting input " #name " to " << _arg); \
954 const DecoratorType *oldInput = \
955 itkDynamicCastInDebugMode< const DecoratorType * >( \
956 this->ProcessObject::GetInput(#name) ); \
957 if ( oldInput && oldInput->Get() == _arg ) \
961 typename DecoratorType::Pointer newInput = DecoratorType::New(); \
962 newInput->Set(_arg); \
963 this->Set##name##Input(newInput); \
971 #define itkGetDecoratedObjectInputMacro(name, type) \
972 virtual const DataObjectDecorator< type > * Get##name##Input() const \
974 itkDebugMacro( "returning input " << #name " of "<< this->ProcessObject::GetInput(#name) ); \
975 return itkDynamicCastInDebugMode< const DataObjectDecorator< type > * >( this->ProcessObject::GetInput(#name) ); \
977 virtual const type * Get##name() const \
979 itkDebugMacro("Getting input " #name); \
980 typedef DataObjectDecorator< type > DecoratorType; \
981 const DecoratorType *input = \
982 itkDynamicCastInDebugMode< const DecoratorType * >( \
983 this->ProcessObject::GetInput(#name) ); \
984 if( input == ITK_NULLPTR ) \
986 return ITK_NULLPTR; \
988 return input->Get(); \
994 #define itkSetGetDecoratedObjectInputMacro(name, type) \
995 itkSetDecoratedObjectInputMacro(name, type) \
996 itkGetDecoratedObjectInputMacro(name, type)
999 #define itkSetMacro(name, type) \
1000 virtual void Set##name (const type _arg) \
1002 itkDebugMacro("setting " #name " to " << _arg); \
1004 CLANG_SUPPRESS_Wfloat_equal \
1005 if ( this->m_##name != _arg ) \
1007 this->m_##name = _arg; \
1015 #define itkGetMacro(name, type) \
1016 virtual type Get##name () \
1018 return this->m_##name; \
1025 #define itkGetConstMacro(name, type) \
1026 virtual type Get##name () const \
1028 return this->m_##name; \
1036 #define itkGetConstReferenceMacro(name, type) \
1037 virtual const type &Get##name () const \
1039 return this->m_##name; \
1047 #define itkSetEnumMacro(name, type) \
1048 virtual void Set##name (const type _arg) \
1050 itkDebugMacro( "setting " #name " to " << static_cast< long >( _arg ) ); \
1051 if ( this->m_##name != _arg ) \
1053 this->m_##name = _arg; \
1063 #define itkGetEnumMacro(name, type) \
1064 virtual type Get##name () const \
1066 return this->m_##name; \
1073 #define itkSetStringMacro(name) \
1074 virtual void Set##name (const char *_arg) \
1076 if ( _arg && ( _arg == this->m_##name ) ) { return; } \
1079 this->m_##name = _arg; \
1083 this->m_##name = ""; \
1087 virtual void Set##name (const std::string & _arg) \
1089 this->Set##name( _arg.c_str() ); \
1097 #define itkGetStringMacro(name) \
1098 virtual const char *Get##name () const \
1100 return this->m_##name.c_str(); \
1106 #define itkSetClampMacro(name, type, min, max) \
1107 virtual void Set##name (type _arg) \
1109 const type temp_extrema=( _arg < min ? min : ( _arg > max ? max : _arg ) );\
1110 itkDebugMacro("setting " << #name " to " << _arg); \
1112 CLANG_SUPPRESS_Wfloat_equal \
1113 if ( this->m_##name != temp_extrema ) \
1115 this->m_##name = temp_extrema; \
1127 #define itkSetObjectMacro(name, type) \
1128 virtual void Set##name (type * _arg) \
1130 itkDebugMacro("setting " << #name " to " << _arg); \
1132 CLANG_SUPPRESS_Wfloat_equal \
1133 if ( this->m_##name != _arg ) \
1135 this->m_##name = _arg; \
1167 #define itkGetConstObjectMacro(name, type) \
1168 virtual const type * Get##name () const \
1170 return this->m_##name.GetPointer(); \
1174 #if defined ( ITK_FUTURE_LEGACY_REMOVE )
1180 # define itkGetObjectMacro(name, type) \
1181 virtual type * Get##name () \
1183 purposeful_error("itkGetObjectMacro should be replaced with itkGetModifiableObjectMacro."); \
1186 # define itkGetModifiableObjectMacro(name, type) \
1187 virtual type * GetModifiable##name () \
1189 return this->m_##name.GetPointer(); \
1191 itkGetConstObjectMacro(name, type)
1193 #else // defined ( ITK_FUTURE_LEGACY_REMOVE )
1196 # define itkGetObjectMacro(name, type) \
1197 virtual type * Get##name () \
1199 return this->m_##name.GetPointer(); \
1201 # define itkGetModifiableObjectMacro(name, type) \
1202 virtual type * GetModifiable##name () \
1204 return this->m_##name.GetPointer(); \
1206 itkGetConstObjectMacro(name, type) \
1207 itkGetObjectMacro(name, type)
1208 #endif // defined ( ITK_FUTURE_LEGACY_REMOVE )
1217 #define itkGetConstReferenceObjectMacro(name, type) \
1218 virtual const typename type::Pointer & Get##name () const \
1220 return this->m_##name; \
1227 #define itkSetConstObjectMacro(name, type) \
1228 virtual void Set##name (const type * _arg) \
1230 itkDebugMacro("setting " << #name " to " << _arg); \
1231 if ( this->m_##name != _arg ) \
1233 this->m_##name = _arg; \
1241 #define itkBooleanMacro(name) \
1242 virtual void name##On () \
1244 this->Set##name(true); \
1246 virtual void name##Off () \
1248 this->Set##name(false); \
1255 #define itkSetVectorMacro(name, type, count) \
1256 virtual void Set##name(type data[]) \
1259 for ( i = 0; i < count; i++ ) \
1262 CLANG_SUPPRESS_Wfloat_equal \
1263 if ( data[i] != this->m_##name[i] ) \
1272 for ( i = 0; i < count; i++ ) \
1274 this->m_##name[i] = data[i]; \
1282 #define itkGetVectorMacro(name, type, count) \
1283 virtual type * Get##name () const \
1285 return this->m_##name; \
1292 #define itkGPUKernelClassMacro(kernel) \