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(ITK_TEMPLATE_VISIBILITY_DEFAULT) && defined(ITK_BUILD_SHARED_LIBS) && defined(USE_COMPILER_HIDDEN_VISIBILITY)
201 #define ITK_FORWARD_EXPORT __attribute__ ((visibility ("default")))
203 #define ITK_FORWARD_EXPORT
207 #if ITK_COMPILED_CXX_STANDARD_VERSION >= 201103L
208 #define ITK_HAS_CXX11_RVREF
211 #if ! defined( ITK_FUTURE_LEGACY_REMOVE )
212 #if ITK_COMPILER_CXX_STATIC_ASSERT
213 #define ITK_HAS_CXX11_STATIC_ASSERT //NOTE DEPRECATED! should be ITK_COMPILER_CXX_STATIC_ASSERT
216 #if ITK_COMPILER_CXX_DELETED_FUNCTIONS
217 #define ITK_DELETE_FUNCTION =delete //NOTE DEPRECATED! should be ITK_DELETED_FUNCTION
219 #define ITK_DELETE_FUNCTION
221 #if ITK_COMPILER_CXX_ALIGNAS //NOTE DEPRECATED! should use ITK_COMPILER_CXX_ALIGNAS
223 #define ITK_HAS_CPP11_ALIGNAS
225 #ifdef ITK_HAS_CPP11_ALIGNAS
226 #undef ITK_HAS_CPP11_ALIGNAS
231 #if ITK_COMPILER_CXX_NOEXCEPT
232 #define ITK_NOEXCEPT_OR_THROW noexcept
234 #define ITK_NOEXCEPT_OR_THROW throw()
237 #if ITK_COMPILER_CXX_CONSTEXPR
238 #define ITK_CONSTEXPR_FUNC constexpr
239 #define ITK_CONSTEXPR_VAR constexpr
241 #define ITK_CONSTEXPR_FUNC inline
242 #define ITK_CONSTEXPR_VAR const
247 #if defined( __GNUC__ ) && !defined( __INTEL_COMPILER )
248 # if ( __GNUC__ >= 7 )
249 # define ITK_FALLTHROUGH __attribute__((fallthrough))
251 #elif ITK_COMPILED_CXX_STANDARD_VERSION >= 201103L && defined(__has_warning)
252 # if __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough")
253 # define ITK_FALLTHROUGH [[clang::fallthrough]]
257 #ifndef ITK_FALLTHROUGH
258 # define ITK_FALLTHROUGH ((void)0)
281 #define itkNewMacro(x) \
282 itkSimpleNewMacro(x) \
283 itkCreateAnotherMacro(x) \
286 #define itkSimpleNewMacro(x) \
287 static Pointer New(void) \
289 Pointer smartPtr = ::itk::ObjectFactory< x >::Create(); \
290 if ( smartPtr.GetPointer() == ITK_NULLPTR ) \
294 smartPtr->UnRegister(); \
298 #define itkCreateAnotherMacro(x) \
299 virtual ::itk::LightObject::Pointer CreateAnother(void) const ITK_OVERRIDE \
301 ::itk::LightObject::Pointer smartPtr; \
302 smartPtr = x::New().GetPointer(); \
306 #define itkCloneMacro(x) \
307 Pointer Clone() const \
310 dynamic_cast<x *>(this->InternalClone().GetPointer()); \
326 #define itkFactorylessNewMacro(x) \
327 static Pointer New(void) \
330 x * rawPtr = new x; \
332 rawPtr->UnRegister(); \
335 virtual ::itk::LightObject::Pointer CreateAnother(void) const ITK_OVERRIDE \
337 ::itk::LightObject::Pointer smartPtr; \
338 smartPtr = x::New().GetPointer(); \
350 #define ITK_DISALLOW_COPY_AND_ASSIGN(TypeName) \
351 TypeName(const TypeName&) ITK_DELETED_FUNCTION; \
352 void operator=(const TypeName&) ITK_DELETED_FUNCTION
356 #define itkTypeMacro(thisClass, superclass) \
357 virtual const char *GetNameOfClass() const ITK_OVERRIDE \
362 #define itkTypeMacroNoParent(thisClass) \
363 virtual const char *GetNameOfClass() const \
376 extern ITKCommon_EXPORT
void OutputWindowDisplayText(
const char *);
379 extern ITKCommon_EXPORT
void OutputWindowDisplayErrorText(
const char *);
381 extern ITKCommon_EXPORT
void OutputWindowDisplayWarningText(
const char *);
383 extern ITKCommon_EXPORT
void OutputWindowDisplayGenericOutputText(
const char *);
385 extern ITKCommon_EXPORT
void OutputWindowDisplayDebugText(
const char *);
391 #if defined( NDEBUG )
392 #define itkDebugMacro(x)
393 #define itkDebugStatement(x)
395 #define itkDebugMacro(x) \
397 if ( this->GetDebug() && ::itk::Object::GetGlobalWarningDisplay() ) \
399 std::ostringstream itkmsg; \
400 itkmsg << "Debug: In " __FILE__ ", line " << __LINE__ << "\n" \
401 << this->GetNameOfClass() << " (" << this << "): " x \
403 ::itk::OutputWindowDisplayDebugText( itkmsg.str().c_str() ); \
410 #define itkDebugStatement(x) x
416 #define itkWarningMacro(x) \
418 if ( ::itk::Object::GetGlobalWarningDisplay() ) \
420 std::ostringstream itkmsg; \
421 itkmsg << "WARNING: In " __FILE__ ", line " << __LINE__ << "\n" \
422 << this->GetNameOfClass() << " (" << this << "): " x \
424 ::itk::OutputWindowDisplayWarningText( itkmsg.str().c_str() ); \
431 #define itkWarningStatement(x) x
433 #if defined( ITK_CPP_FUNCTION )
434 #if defined( _WIN32 ) && !defined( __MINGW32__ ) && !defined( ITK_WRAPPING_PARSER )
435 #define ITK_LOCATION __FUNCSIG__
436 #elif defined( __GNUC__ )
437 #define ITK_LOCATION __PRETTY_FUNCTION__
439 #define ITK_LOCATION __FUNCTION__
442 #define ITK_LOCATION "unknown"
450 #define itkExceptionMacro(x) \
452 std::ostringstream message; \
453 message << "itk::ERROR: " << this->GetNameOfClass() \
454 << "(" << this << "): " x; \
455 ::itk::ExceptionObject e_(__FILE__, __LINE__, message.str().c_str(), ITK_LOCATION); \
460 #define itkGenericExceptionMacro(x) \
462 std::ostringstream message; \
463 message << "itk::ERROR: " x; \
464 ::itk::ExceptionObject e_(__FILE__, __LINE__, message.str().c_str(), ITK_LOCATION); \
468 #define itkDeclareExceptionMacro(newexcp,parentexcp,whatmessage) \
470 class newexcp : public parentexcp \
473 newexcp( const char *file, unsigned int lineNumber ) : \
474 parentexcp( file, lineNumber ) \
476 this->SetDescription( whatmessage ); \
478 newexcp( const std::string & file, unsigned int lineNumber ) : \
479 parentexcp( file, lineNumber ) \
481 this->SetDescription( whatmessage ); \
483 itkTypeMacro(newexcp, parentexcp); \
487 #define itkSpecializedExceptionMacro(exceptiontype) \
489 ::itk::exceptiontype e_(__FILE__, __LINE__); \
490 e_.SetLocation(ITK_LOCATION); \
494 #define itkSpecializedMessageExceptionMacro(exceptiontype,x) \
496 ::itk::exceptiontype e_(__FILE__, __LINE__); \
497 std::ostringstream message; \
498 message << "itk::ERROR: " x; \
499 e_.SetDescription(message.str().c_str()); \
500 e_.SetLocation(ITK_LOCATION); \
505 #define itkGenericOutputMacro(x) \
507 if ( ::itk::Object::GetGlobalWarningDisplay() ) \
509 std::ostringstream itkmsg; \
510 itkmsg << "WARNING: In " __FILE__ ", line " << __LINE__ << "\n" \
512 ::itk::OutputWindowDisplayGenericOutputText( itkmsg.str().c_str() ); \
519 #define itkLogMacro(x, y) \
521 if ( this->GetLogger() ) \
523 this->GetLogger()->Write(::itk::LoggerBase::x, y); \
527 #define itkLogMacroStatic(obj, x, y) \
529 if ( obj->GetLogger() ) \
531 obj->GetLogger()->Write(::itk::LoggerBase::x, y); \
559 #if defined( ITK_LEGACY_REMOVE )
560 #define itkLegacyMacro(method)
561 #elif defined( ITK_LEGACY_SILENT ) || defined( ITK_LEGACY_TEST ) || defined( ITK_WRAPPING_PARSER )
563 #define itkLegacyMacro(method) method
567 #if defined( __GNUC__ ) && !defined( __INTEL_COMPILER ) && ( __GNUC__ > 3 || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 1 ) )
568 #define itkLegacyMacro(method) method __attribute__( ( deprecated ) )
569 #elif defined( _MSC_VER )
570 #define itkLegacyMacro(method) __declspec(deprecated) method
572 #define itkLegacyMacro(method) method
591 #if defined( ITK_LEGACY_REMOVE ) || defined( ITK_LEGACY_SILENT )
592 #define itkLegacyBodyMacro(method, version)
593 #define itkLegacyReplaceBodyMacro(method, version, replace)
594 #define itkGenericLegacyBodyMacro(method, version)
595 #define itkGenericLegacyReplaceBodyMacro(method, version, replace)
597 #define itkLegacyBodyMacro(method, version) \
598 itkWarningMacro(#method " was deprecated for ITK " #version " and will be removed in a future version.")
599 #define itkLegacyReplaceBodyMacro(method, version, replace) \
601 #method " was deprecated for ITK " #version " and will be removed in a future version. Use " #replace \
603 #define itkGenericLegacyBodyMacro(method, version) \
604 itkGenericOutputMacro(#method " was deprecated for ITK " #version " and will be removed in a future version.")
605 #define itkGenericLegacyReplaceBodyMacro(method, version, replace) \
606 itkGenericOutputMacro( \
607 #method " was deprecated for ITK " #version " and will be removed in a future version. Use " #replace \
611 #if defined ( ITK_LEGACY_REMOVE )
612 #define ITK_TEMPLATE_TXX "error ITK_TEMPLATE_TXX is no longer a supported identifier, you should replace with ITK_MANUAL_INSTANTIATION as a replacement"
614 #define ITK_TEMPLATE_TXX 1
622 #define ITK_CACHE_LINE_ALIGNMENT 64
630 #define itkPadStruct( mincachesize, oldtype, newtype ) \
631 struct newtype: public oldtype \
633 char _StructPadding[mincachesize - (sizeof(oldtype)%mincachesize) ]; \
640 #if defined( ITK_HAS_GNU_ATTRIBUTE_ALIGNED )
641 # define itkAlignedTypedef( alignment, oldtype, newtype ) \
642 typedef oldtype newtype __attribute__((aligned(alignment)))
643 #elif defined ( _MSC_VER )
644 # define itkAlignedTypedef( alignment, oldtype, newtype ) \
645 typedef __declspec(align( alignment )) oldtype newtype
647 # define itkAlignedTypedef( alignment, oldtype, newtype ) \
648 typedef oldtype newtype
680 #if defined( ITK_SUPPORTS_TEMPLATED_FRIEND_FUNCTION_WITH_NULL_STRING )
681 #define ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT(T)
683 #if defined( ITK_SUPPORTS_TEMPLATED_FRIEND_FUNCTION_WITH_EMPTY_BRACKETS )
684 #define ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT(T) < >
686 #if defined( ITK_SUPPORTS_TEMPLATED_FRIEND_FUNCTION_WITH_TEMPLATE_ARGUMENTS )
687 #define ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT(T) < T >
693 #if ( defined ( _MSC_VER ) && ( _MSC_VER >= 1600 ) )
694 #ifdef ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT
695 #undef ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT
697 #define ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT(T)
713 #define itkForLoopAssignmentMacro(DestinationType, \
715 DestinationElementType, \
718 NumberOfIterations) \
719 for ( unsigned int i = 0; i < NumberOfIterations; ++i ) \
721 DestinationArray[i] = static_cast< DestinationElementType >( SourceArray[i] ); \
733 #define itkForLoopRoundingAndAssignmentMacro(DestinationType, \
734 Sourcrnd_halfintup, \
735 DestinationElementType, \
738 NumberOfIterations) \
739 for ( unsigned int i = 0; i < NumberOfIterations; ++i ) \
741 DestinationArray[i] = itk::Math::Round< DestinationElementType >(SourceArray[i]); \
749 #define itkAssertInDebugOrThrowInReleaseMacro(msg) __assert_fail (msg, __FILE__, __LINE__, __ASSERT_FUNCTION);
751 #define itkAssertInDebugOrThrowInReleaseMacro(msg) itkGenericExceptionMacro(<< msg);
755 #define itkAssertInDebugOrThrowInReleaseMacro(msg) itkGenericExceptionMacro(<< msg);
758 #define itkAssertOrThrowMacro(test, message) \
761 std::ostringstream msgstr; \
763 itkAssertInDebugOrThrowInReleaseMacro( msgstr.str().c_str() ); \
767 #define itkAssertInDebugAndIgnoreInReleaseMacro(X) assert(X)
769 #define itkAssertInDebugAndIgnoreInReleaseMacro(X)
772 #ifdef ITKV3_COMPATIBILITY
776 #define ITK_TYPENAME typename
782 template <
typename TTarget,
typename TSource>
783 TTarget itkDynamicCastInDebugMode(TSource x)
790 TTarget rval =
dynamic_cast<TTarget
>(x);
793 itkGenericExceptionMacro(<<
"Failed dynamic cast to "
794 <<
typeid(TTarget).name()
796 << x->GetNameOfClass());
800 return static_cast<TTarget
>(x);
824 #if defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__ ) < 405 && !defined( __clang__ ) && !defined( __INTEL_COMPILER )
825 # define itkStaticConstMacro(name,type,value) enum { name = value }
827 # define itkStaticConstMacro(name,type,value) static ITK_CONSTEXPR_VAR type name = value
830 #define itkGetStaticConstMacro(name) (Self::name)
833 #define itkSetInputMacro(name, type) \
834 virtual void Set##name(const type *_arg) \
836 itkDebugMacro("setting input " #name " to " << _arg); \
837 if ( _arg != itkDynamicCastInDebugMode< type * >( this->ProcessObject::GetInput(#name) ) ) \
839 this->ProcessObject::SetInput( #name, const_cast< type * >( _arg ) ); \
846 #define itkGetInputMacro(name, type) \
847 virtual const type * Get##name() const \
849 itkDebugMacro( "returning input " << #name " of " << this->ProcessObject::GetInput(#name) ); \
850 return itkDynamicCastInDebugMode< const type * >( this->ProcessObject::GetInput(#name) ); \
855 #define itkSetDecoratedInputMacro(name, type) \
856 virtual void Set##name##Input(const SimpleDataObjectDecorator< type > *_arg) \
858 itkDebugMacro("setting input " #name " to " << _arg); \
859 if ( _arg != itkDynamicCastInDebugMode< SimpleDataObjectDecorator< type > * >( this->ProcessObject::GetInput(#name) ) ) \
861 this->ProcessObject::SetInput( #name, const_cast< SimpleDataObjectDecorator< type > * >( _arg ) ); \
865 virtual void Set##name(const SimpleDataObjectDecorator< type > *_arg) \
867 this->Set##name##Input(_arg); \
869 virtual void Set##name(const type &_arg) \
871 typedef SimpleDataObjectDecorator< type > DecoratorType; \
872 itkDebugMacro("setting input " #name " to " << _arg); \
873 const DecoratorType *oldInput = \
874 itkDynamicCastInDebugMode< const DecoratorType * >( \
875 this->ProcessObject::GetInput(#name) ); \
877 CLANG_SUPPRESS_Wfloat_equal \
878 if ( oldInput && oldInput->Get() == _arg ) \
883 typename DecoratorType::Pointer newInput = DecoratorType::New(); \
884 newInput->Set(_arg); \
885 this->Set##name##Input(newInput); \
890 #define itkGetDecoratedInputMacro(name, type) \
891 virtual const SimpleDataObjectDecorator< type > * Get##name##Input() const \
893 itkDebugMacro( "returning input " << #name " of " << this->ProcessObject::GetInput(#name) ); \
894 return itkDynamicCastInDebugMode< const SimpleDataObjectDecorator< type > * >( this->ProcessObject::GetInput(#name) ); \
896 virtual const type & Get##name() const \
898 itkDebugMacro("Getting input " #name); \
899 typedef SimpleDataObjectDecorator< type > DecoratorType; \
900 const DecoratorType *input = \
901 itkDynamicCastInDebugMode< const DecoratorType * >( \
902 this->ProcessObject::GetInput(#name) ); \
903 if( input == ITK_NULLPTR ) \
905 itkExceptionMacro(<<"input" #name " is not set"); \
907 return input->Get(); \
913 #define itkSetGetDecoratedInputMacro(name, type) \
914 itkSetDecoratedInputMacro(name, type) \
915 itkGetDecoratedInputMacro(name, type)
921 #define itkSetDecoratedObjectInputMacro(name, type) \
922 virtual void Set##name##Input(const DataObjectDecorator< type > *_arg) \
924 itkDebugMacro("setting input " #name " to " << _arg); \
925 if ( _arg != itkDynamicCastInDebugMode< DataObjectDecorator< type > * >( this->ProcessObject::GetInput(#name) ) ) \
927 this->ProcessObject::SetInput( #name, const_cast< DataObjectDecorator< type > * >( _arg ) ); \
931 virtual void Set##name(const type * _arg) \
933 typedef DataObjectDecorator< type > DecoratorType; \
934 itkDebugMacro("setting input " #name " to " << _arg); \
935 const DecoratorType *oldInput = \
936 itkDynamicCastInDebugMode< const DecoratorType * >( \
937 this->ProcessObject::GetInput(#name) ); \
938 if ( oldInput && oldInput->Get() == _arg ) \
942 typename DecoratorType::Pointer newInput = DecoratorType::New(); \
943 newInput->Set(_arg); \
944 this->Set##name##Input(newInput); \
952 #define itkGetDecoratedObjectInputMacro(name, type) \
953 virtual const DataObjectDecorator< type > * Get##name##Input() const \
955 itkDebugMacro( "returning input " << #name " of "<< this->ProcessObject::GetInput(#name) ); \
956 return itkDynamicCastInDebugMode< const DataObjectDecorator< type > * >( this->ProcessObject::GetInput(#name) ); \
958 virtual const type * Get##name() const \
960 itkDebugMacro("Getting input " #name); \
961 typedef DataObjectDecorator< type > DecoratorType; \
962 const DecoratorType *input = \
963 itkDynamicCastInDebugMode< const DecoratorType * >( \
964 this->ProcessObject::GetInput(#name) ); \
965 if( input == ITK_NULLPTR ) \
967 return ITK_NULLPTR; \
969 return input->Get(); \
975 #define itkSetGetDecoratedObjectInputMacro(name, type) \
976 itkSetDecoratedObjectInputMacro(name, type) \
977 itkGetDecoratedObjectInputMacro(name, type)
980 #define itkSetMacro(name, type) \
981 virtual void Set##name (const type _arg) \
983 itkDebugMacro("setting " #name " to " << _arg); \
985 CLANG_SUPPRESS_Wfloat_equal \
986 if ( this->m_##name != _arg ) \
988 this->m_##name = _arg; \
996 #define itkGetMacro(name, type) \
997 virtual type Get##name () \
999 return this->m_##name; \
1006 #define itkGetConstMacro(name, type) \
1007 virtual type Get##name () const \
1009 return this->m_##name; \
1017 #define itkGetConstReferenceMacro(name, type) \
1018 virtual const type &Get##name () const \
1020 return this->m_##name; \
1028 #define itkSetEnumMacro(name, type) \
1029 virtual void Set##name (const type _arg) \
1031 itkDebugMacro( "setting " #name " to " << static_cast< long >( _arg ) ); \
1032 if ( this->m_##name != _arg ) \
1034 this->m_##name = _arg; \
1044 #define itkGetEnumMacro(name, type) \
1045 virtual type Get##name () const \
1047 return this->m_##name; \
1054 #define itkSetStringMacro(name) \
1055 virtual void Set##name (const char *_arg) \
1057 if ( _arg && ( _arg == this->m_##name ) ) { return; } \
1060 this->m_##name = _arg; \
1064 this->m_##name = ""; \
1068 virtual void Set##name (const std::string & _arg) \
1070 this->Set##name( _arg.c_str() ); \
1078 #define itkGetStringMacro(name) \
1079 virtual const char *Get##name () const \
1081 return this->m_##name.c_str(); \
1087 #define itkSetClampMacro(name, type, min, max) \
1088 virtual void Set##name (type _arg) \
1090 const type temp_extrema=( _arg < min ? min : ( _arg > max ? max : _arg ) );\
1091 itkDebugMacro("setting " << #name " to " << _arg); \
1093 CLANG_SUPPRESS_Wfloat_equal \
1094 if ( this->m_##name != temp_extrema ) \
1096 this->m_##name = temp_extrema; \
1108 #define itkSetObjectMacro(name, type) \
1109 virtual void Set##name (type * _arg) \
1111 itkDebugMacro("setting " << #name " to " << _arg); \
1113 CLANG_SUPPRESS_Wfloat_equal \
1114 if ( this->m_##name != _arg ) \
1116 this->m_##name = _arg; \
1148 #define itkGetConstObjectMacro(name, type) \
1149 virtual const type * Get##name () const \
1151 return this->m_##name.GetPointer(); \
1155 #if defined ( ITK_FUTURE_LEGACY_REMOVE )
1161 # define itkGetObjectMacro(name, type) \
1162 virtual type * Get##name () \
1164 purposeful_error("itkGetObjectMacro should be replaced with itkGetModifiableObjectMacro."); \
1167 # define itkGetModifiableObjectMacro(name, type) \
1168 virtual type * GetModifiable##name () \
1170 return this->m_##name.GetPointer(); \
1172 itkGetConstObjectMacro(name, type)
1174 #else // defined ( ITK_FUTURE_LEGACY_REMOVE )
1177 # define itkGetObjectMacro(name, type) \
1178 virtual type * Get##name () \
1180 return this->m_##name.GetPointer(); \
1182 # define itkGetModifiableObjectMacro(name, type) \
1183 virtual type * GetModifiable##name () \
1185 return this->m_##name.GetPointer(); \
1187 itkGetConstObjectMacro(name, type) \
1188 itkGetObjectMacro(name, type)
1189 #endif // defined ( ITK_FUTURE_LEGACY_REMOVE )
1198 #define itkGetConstReferenceObjectMacro(name, type) \
1199 virtual const typename type::Pointer & Get##name () const \
1201 return this->m_##name; \
1208 #define itkSetConstObjectMacro(name, type) \
1209 virtual void Set##name (const type * _arg) \
1211 itkDebugMacro("setting " << #name " to " << _arg); \
1212 if ( this->m_##name != _arg ) \
1214 this->m_##name = _arg; \
1222 #define itkBooleanMacro(name) \
1223 virtual void name##On () \
1225 this->Set##name(true); \
1227 virtual void name##Off () \
1229 this->Set##name(false); \
1236 #define itkSetVectorMacro(name, type, count) \
1237 virtual void Set##name(type data[]) \
1240 for ( i = 0; i < count; i++ ) \
1243 CLANG_SUPPRESS_Wfloat_equal \
1244 if ( data[i] != this->m_##name[i] ) \
1253 for ( i = 0; i < count; i++ ) \
1255 this->m_##name[i] = data[i]; \
1263 #define itkGetVectorMacro(name, type, count) \
1264 virtual type * Get##name () const \
1266 return this->m_##name; \
1273 #define itkGPUKernelClassMacro(kernel) \