42 #include "itkConfigure.h"
43 #include "ITKCommonExport.h"
73 #if defined(__clang__) && defined(__has_warning)
74 #define CLANG_PRAGMA_PUSH _Pragma("clang diagnostic push")
75 #define CLANG_PRAGMA_POP _Pragma("clang diagnostic pop")
76 # if __has_warning("-Wfloat-equal")
77 #define CLANG_SUPPRESS_Wfloat_equal _Pragma("clang diagnostic ignored \"-Wfloat-equal\"" )
80 #define CLANG_PRAGMA_PUSH
81 #define CLANG_PRAGMA_POP
82 #define CLANG_SUPPRESS_Wfloat_equal
97 #if defined( _MSC_VER ) && ( _MSC_VER < 1310 )
100 #if defined( __SUNPRO_CC ) && ( __SUNPRO_CC < 0x590 )
101 #error "__SUNPRO_CC < 0x590 not supported under ITKv4"
103 #if defined( __CYGWIN__ )
104 #error "The Cygwin compiler is not supported in ITKv4 and above"
106 #if defined( __BORLANDC__ )
107 #error "The Borland C compiler is not supported in ITKv4 and above"
109 #if defined( __MWERKS__ )
110 #error "The MetroWerks compiler is not supported in ITKv4 and above"
112 #if defined( __GNUC__ ) && ( __GNUC__ < 3 )
113 #error "The __GNUC__ version 2.95 compiler is not supprted under ITKv4 and above"
118 #error "The __sgi compiler is not supprted under ITKv4 and above"
123 #if defined( _WIN32 ) || defined ( WIN32 )
124 #define ITK_ABI_IMPORT __declspec(dllimport)
125 #define ITK_ABI_EXPORT __declspec(dllexport)
126 #define ITK_ABI_HIDDEN
129 #define ITK_ABI_IMPORT __attribute__ ((visibility ("default")))
130 #define ITK_ABI_EXPORT __attribute__ ((visibility ("default")))
131 #define ITK_ABI_HIDDEN __attribute__ ((visibility ("hidden")))
133 #define ITK_ABI_IMPORT
134 #define ITK_ABI_EXPORT
135 #define ITK_ABI_HIDDEN
139 #if __cplusplus >= 201103L
143 #define ITK_OVERRIDE override
149 #define ITK_NULLPTR nullptr
155 #define ITK_NOEXCEPT noexcept
158 #define ITK_NULLPTR NULL
159 #define ITK_NOEXCEPT throw()
183 #define itkNewMacro(x) \
184 itkSimpleNewMacro(x) \
185 itkCreateAnotherMacro(x) \
188 #define itkSimpleNewMacro(x) \
189 static Pointer New(void) \
191 Pointer smartPtr = ::itk::ObjectFactory< x >::Create(); \
192 if ( smartPtr.GetPointer() == ITK_NULLPTR ) \
196 smartPtr->UnRegister(); \
200 #define itkCreateAnotherMacro(x) \
201 virtual ::itk::LightObject::Pointer CreateAnother(void) const ITK_OVERRIDE \
203 ::itk::LightObject::Pointer smartPtr; \
204 smartPtr = x::New().GetPointer(); \
208 #define itkCloneMacro(x) \
209 Pointer Clone() const \
212 dynamic_cast<x *>(this->InternalClone().GetPointer()); \
232 #define itkFactorylessNewMacro(x) \
233 static Pointer New(void) \
236 x * rawPtr = new x; \
238 rawPtr->UnRegister(); \
241 virtual ::itk::LightObject::Pointer CreateAnother(void) const ITK_OVERRIDE \
243 ::itk::LightObject::Pointer smartPtr; \
244 smartPtr = x::New().GetPointer(); \
251 #define itkTypeMacro(thisClass, superclass) \
252 virtual const char *GetNameOfClass() const ITK_OVERRIDE \
257 #define itkTypeMacroNoParent(thisClass) \
258 virtual const char *GetNameOfClass() const \
271 extern ITKCommon_EXPORT
void OutputWindowDisplayText(
const char *);
274 extern ITKCommon_EXPORT
void OutputWindowDisplayErrorText(
const char *);
276 extern ITKCommon_EXPORT
void OutputWindowDisplayWarningText(
const char *);
278 extern ITKCommon_EXPORT
void OutputWindowDisplayGenericOutputText(
const char *);
280 extern ITKCommon_EXPORT
void OutputWindowDisplayDebugText(
const char *);
286 #if defined( NDEBUG )
287 #define itkDebugMacro(x)
288 #define itkDebugStatement(x)
290 #define itkDebugMacro(x) \
292 if ( this->GetDebug() && ::itk::Object::GetGlobalWarningDisplay() ) \
294 std::ostringstream itkmsg; \
295 itkmsg << "Debug: In " __FILE__ ", line " << __LINE__ << "\n" \
296 << this->GetNameOfClass() << " (" << this << "): " x \
298 ::itk::OutputWindowDisplayDebugText( itkmsg.str().c_str() ); \
305 #define itkDebugStatement(x) x
311 #define itkWarningMacro(x) \
313 if ( ::itk::Object::GetGlobalWarningDisplay() ) \
315 std::ostringstream itkmsg; \
316 itkmsg << "WARNING: In " __FILE__ ", line " << __LINE__ << "\n" \
317 << this->GetNameOfClass() << " (" << this << "): " x \
319 ::itk::OutputWindowDisplayWarningText( itkmsg.str().c_str() ); \
326 #define itkWarningStatement(x) x
328 #if defined( ITK_CPP_FUNCTION )
329 #if defined( _WIN32 ) && !defined( __MINGW32__ ) && !defined( CABLE_CONFIGURATION ) \
330 && !defined( __GCCXML__ )
331 #define ITK_LOCATION __FUNCSIG__
332 #elif defined( __GNUC__ )
333 #define ITK_LOCATION __PRETTY_FUNCTION__
335 #define ITK_LOCATION __FUNCTION__
338 #define ITK_LOCATION "unknown"
346 #define itkExceptionMacro(x) \
348 std::ostringstream message; \
349 message << "itk::ERROR: " << this->GetNameOfClass() \
350 << "(" << this << "): " x; \
351 ::itk::ExceptionObject e_(__FILE__, __LINE__, message.str().c_str(), ITK_LOCATION); \
356 #define itkGenericExceptionMacro(x) \
358 std::ostringstream message; \
359 message << "itk::ERROR: " x; \
360 ::itk::ExceptionObject e_(__FILE__, __LINE__, message.str().c_str(), ITK_LOCATION); \
364 #define itkDeclareExceptionMacro(newexcp,parentexcp,whatmessage) \
366 class newexcp : public parentexcp \
369 newexcp( const char *file, unsigned int lineNumber ) : \
370 parentexcp( file, lineNumber ) \
372 this->SetDescription( whatmessage ); \
374 newexcp( const std::string & file, unsigned int lineNumber ) : \
375 parentexcp( file, lineNumber ) \
377 this->SetDescription( whatmessage ); \
379 itkTypeMacro(newexcp, parentexcp); \
383 #define itkSpecializedExceptionMacro(exceptiontype) \
385 ::itk::exceptiontype e_(__FILE__, __LINE__); \
386 e_.SetLocation(ITK_LOCATION); \
390 #define itkSpecializedMessageExceptionMacro(exceptiontype,x) \
392 ::itk::exceptiontype e_(__FILE__, __LINE__); \
393 std::ostringstream message; \
394 message << "itk::ERROR: " x; \
395 e_.SetDescription(message.str().c_str()); \
396 e_.SetLocation(ITK_LOCATION); \
401 #define itkGenericOutputMacro(x) \
403 if ( ::itk::Object::GetGlobalWarningDisplay() ) \
405 std::ostringstream itkmsg; \
406 itkmsg << "WARNING: In " __FILE__ ", line " << __LINE__ << "\n" \
408 ::itk::OutputWindowDisplayGenericOutputText( itkmsg.str().c_str() ); \
415 #define itkLogMacro(x, y) \
417 if ( this->GetLogger() ) \
419 this->GetLogger()->Write(::itk::LoggerBase::x, y); \
423 #define itkLogMacroStatic(obj, x, y) \
425 if ( obj->GetLogger() ) \
427 obj->GetLogger()->Write(::itk::LoggerBase::x, y); \
453 #if defined( ITK_LEGACY_REMOVE )
454 #define itkLegacyMacro(method)
455 #elif defined( ITK_LEGACY_SILENT ) || defined( ITK_LEGACY_TEST ) || defined( __GCCXML__ )
457 #define itkLegacyMacro(method) method
461 #if defined( __GNUC__ ) && !defined( __INTEL_COMPILER ) && ( __GNUC__ > 3 || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 1 ) )
462 #define itkLegacyMacro(method) method __attribute__( ( deprecated ) )
463 #elif defined( _MSC_VER )
464 #define itkLegacyMacro(method) __declspec(deprecated) method
466 #define itkLegacyMacro(method) method
483 #if defined( ITK_LEGACY_REMOVE ) || defined( ITK_LEGACY_SILENT )
484 #define itkLegacyBodyMacro(method, version)
485 #define itkLegacyReplaceBodyMacro(method, version, replace)
486 #define itkGenericLegacyBodyMacro(method, version)
487 #define itkGenericLegacyReplaceBodyMacro(method, version, replace)
489 #define itkLegacyBodyMacro(method, version) \
490 itkWarningMacro(#method " was deprecated for ITK " #version " and will be removed in a future version.")
491 #define itkLegacyReplaceBodyMacro(method, version, replace) \
493 #method " was deprecated for ITK " #version " and will be removed in a future version. Use " #replace \
495 #define itkGenericLegacyBodyMacro(method, version) \
496 itkGenericOutputMacro(#method " was deprecated for ITK " #version " and will be removed in a future version.")
497 #define itkGenericLegacyReplaceBodyMacro(method, version, replace) \
498 itkGenericOutputMacro( \
499 #method " was deprecated for ITK " #version " and will be removed in a future version. Use " #replace \
503 #if defined ( ITK_LEGACY_REMOVE )
504 #define ITK_TEMPLATE_TXX "error ITK_TEMPLATE_TXX is no longer a supported identifier, you should replace with ITK_MANUAL_INSTANTIATION as a replacement"
506 #define ITK_TEMPLATE_TXX 1
514 #define ITK_CACHE_LINE_ALIGNMENT 64
522 #define itkPadStruct( mincachesize, oldtype, newtype ) \
523 struct newtype: public oldtype \
525 char _StructPadding[mincachesize - (sizeof(oldtype)%mincachesize) ]; \
532 #if defined ( ITK_HAS_CPP11_ALIGNAS )
533 # define itkAlignedTypedef( alignment, oldtype, newtype ) \
534 typedef oldtype newtype alignas(alignment)
535 #elif defined( ITK_HAS_GNU_ATTRIBUTE_ALIGNED )
536 # define itkAlignedTypedef( alignment, oldtype, newtype ) \
537 typedef oldtype newtype __attribute__((aligned(alignment)))
538 #elif defined ( _MSC_VER )
539 # define itkAlignedTypedef( alignment, oldtype, newtype ) \
540 typedef __declspec(align( alignment )) oldtype newtype
542 # define itkAlignedTypedef( alignment, oldtype, newtype ) \
543 typedef oldtype newtype
575 #if defined( ITK_SUPPORTS_TEMPLATED_FRIEND_FUNCTION_WITH_NULL_STRING )
576 #define ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT(T)
578 #if defined( ITK_SUPPORTS_TEMPLATED_FRIEND_FUNCTION_WITH_EMPTY_BRACKETS )
579 #define ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT(T) < >
581 #if defined( ITK_SUPPORTS_TEMPLATED_FRIEND_FUNCTION_WITH_TEMPLATE_ARGUMENTS )
582 #define ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT(T) < T >
588 #if ( defined ( _MSC_VER ) && ( _MSC_VER >= 1600 ) )
589 #ifdef ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT
590 #undef ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT
592 #define ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT(T)
608 #define itkForLoopAssignmentMacro(DestinationType, \
610 DestinationElementType, \
613 NumberOfIterations) \
614 for ( unsigned int i = 0; i < NumberOfIterations; ++i ) \
616 DestinationArray[i] = static_cast< DestinationElementType >( SourceArray[i] ); \
628 #define itkForLoopRoundingAndAssignmentMacro(DestinationType, \
629 Sourcrnd_halfintup, \
630 DestinationElementType, \
633 NumberOfIterations) \
634 for ( unsigned int i = 0; i < NumberOfIterations; ++i ) \
636 DestinationArray[i] = itk::Math::Round< DestinationElementType >(SourceArray[i]); \
644 #define itkAssertInDebugOrThrowInReleaseMacro(msg) __assert_fail (msg, __FILE__, __LINE__, __ASSERT_FUNCTION);
646 #define itkAssertInDebugOrThrowInReleaseMacro(msg) itkGenericExceptionMacro(<< msg);
650 #define itkAssertInDebugOrThrowInReleaseMacro(msg) itkGenericExceptionMacro(<< msg);
653 #define itkAssertOrThrowMacro(test, message) \
656 std::ostringstream msgstr; \
658 itkAssertInDebugOrThrowInReleaseMacro( msgstr.str().c_str() ); \
662 #define itkAssertInDebugAndIgnoreInReleaseMacro(X) assert(X)
664 #define itkAssertInDebugAndIgnoreInReleaseMacro(X)
667 #ifdef ITKV3_COMPATIBILITY
671 #define ITK_TYPENAME typename
677 template <
typename TTarget,
typename TSource>
678 TTarget itkDynamicCastInDebugMode(TSource x)
685 TTarget rval =
dynamic_cast<TTarget
>(x);
688 itkGenericExceptionMacro(<<
"Failed dynamic cast to "
689 <<
typeid(TTarget).name()
691 << x->GetNameOfClass());
695 return static_cast<TTarget
>(x);
708 #define itkStaticConstMacro(name, type, value) enum { name = value }
710 #define itkGetStaticConstMacro(name) (Self::name)
713 #define itkSetInputMacro(name, type) \
714 virtual void Set##name(const type *_arg) \
716 itkDebugMacro("setting input " #name " to " << _arg); \
717 if ( _arg != itkDynamicCastInDebugMode< type * >( this->ProcessObject::GetInput(#name) ) ) \
719 this->ProcessObject::SetInput( #name, const_cast< type * >( _arg ) ); \
726 #define itkGetInputMacro(name, type) \
727 virtual const type * Get##name() const \
729 itkDebugMacro( "returning input " << #name " of " << this->ProcessObject::GetInput(#name) ); \
730 return itkDynamicCastInDebugMode< const type * >( this->ProcessObject::GetInput(#name) ); \
735 #define itkSetDecoratedInputMacro(name, type) \
736 virtual void Set##name##Input(const SimpleDataObjectDecorator< type > *_arg) \
738 itkDebugMacro("setting input " #name " to " << _arg); \
739 if ( _arg != itkDynamicCastInDebugMode< SimpleDataObjectDecorator< type > * >( this->ProcessObject::GetInput(#name) ) ) \
741 this->ProcessObject::SetInput( #name, const_cast< SimpleDataObjectDecorator< type > * >( _arg ) ); \
745 virtual void Set##name(const SimpleDataObjectDecorator< type > *_arg) \
747 this->Set##name##Input(_arg); \
749 virtual void Set##name(const type &_arg) \
751 typedef SimpleDataObjectDecorator< type > DecoratorType; \
752 itkDebugMacro("setting input " #name " to " << _arg); \
753 const DecoratorType *oldInput = \
754 itkDynamicCastInDebugMode< const DecoratorType * >( \
755 this->ProcessObject::GetInput(#name) ); \
756 if ( oldInput && oldInput->Get() == _arg ) \
760 typename DecoratorType::Pointer newInput = DecoratorType::New(); \
761 newInput->Set(_arg); \
762 this->Set##name##Input(newInput); \
767 #define itkGetDecoratedInputMacro(name, type) \
768 virtual const SimpleDataObjectDecorator< type > * Get##name##Input() const \
770 itkDebugMacro( "returning input " << #name " of " << this->ProcessObject::GetInput(#name) ); \
771 return itkDynamicCastInDebugMode< const SimpleDataObjectDecorator< type > * >( this->ProcessObject::GetInput(#name) ); \
773 virtual const type & Get##name() const \
775 itkDebugMacro("Getting input " #name); \
776 typedef SimpleDataObjectDecorator< type > DecoratorType; \
777 const DecoratorType *input = \
778 itkDynamicCastInDebugMode< const DecoratorType * >( \
779 this->ProcessObject::GetInput(#name) ); \
780 if( input == ITK_NULLPTR ) \
782 itkExceptionMacro(<<"input" #name " is not set"); \
784 return input->Get(); \
790 #define itkSetGetDecoratedInputMacro(name, type) \
791 itkSetDecoratedInputMacro(name, type) \
792 itkGetDecoratedInputMacro(name, type)
798 #define itkSetDecoratedObjectInputMacro(name, type) \
799 virtual void Set##name##Input(const DataObjectDecorator< type > *_arg) \
801 itkDebugMacro("setting input " #name " to " << _arg); \
802 if ( _arg != itkDynamicCastInDebugMode< DataObjectDecorator< type > * >( this->ProcessObject::GetInput(#name) ) ) \
804 this->ProcessObject::SetInput( #name, const_cast< DataObjectDecorator< type > * >( _arg ) ); \
808 virtual void Set##name(const type * _arg) \
810 typedef DataObjectDecorator< type > DecoratorType; \
811 itkDebugMacro("setting input " #name " to " << _arg); \
812 const DecoratorType *oldInput = \
813 itkDynamicCastInDebugMode< const DecoratorType * >( \
814 this->ProcessObject::GetInput(#name) ); \
815 if ( oldInput && oldInput->Get() == _arg ) \
819 typename DecoratorType::Pointer newInput = DecoratorType::New(); \
820 newInput->Set(_arg); \
821 this->Set##name##Input(newInput); \
829 #define itkGetDecoratedObjectInputMacro(name, type) \
830 virtual const DataObjectDecorator< type > * Get##name##Input() const \
832 itkDebugMacro( "returning input " << #name " of "<< this->ProcessObject::GetInput(#name) ); \
833 return itkDynamicCastInDebugMode< const DataObjectDecorator< type > * >( this->ProcessObject::GetInput(#name) ); \
835 virtual const type * Get##name() const \
837 itkDebugMacro("Getting input " #name); \
838 typedef DataObjectDecorator< type > DecoratorType; \
839 const DecoratorType *input = \
840 itkDynamicCastInDebugMode< const DecoratorType * >( \
841 this->ProcessObject::GetInput(#name) ); \
842 if( input == ITK_NULLPTR ) \
844 return ITK_NULLPTR; \
846 return input->Get(); \
852 #define itkSetGetDecoratedObjectInputMacro(name, type) \
853 itkSetDecoratedObjectInputMacro(name, type) \
854 itkGetDecoratedObjectInputMacro(name, type)
857 #define itkSetMacro(name, type) \
858 virtual void Set##name (const type _arg) \
860 itkDebugMacro("setting " #name " to " << _arg); \
862 CLANG_SUPPRESS_Wfloat_equal \
863 if ( this->m_##name != _arg ) \
865 this->m_##name = _arg; \
873 #define itkGetMacro(name, type) \
874 virtual type Get##name () \
876 return this->m_##name; \
883 #define itkGetConstMacro(name, type) \
884 virtual type Get##name () const \
886 return this->m_##name; \
894 #define itkGetConstReferenceMacro(name, type) \
895 virtual const type &Get##name () const \
897 return this->m_##name; \
905 #define itkSetEnumMacro(name, type) \
906 virtual void Set##name (const type _arg) \
908 itkDebugMacro( "setting " #name " to " << static_cast< long >( _arg ) ); \
909 if ( this->m_##name != _arg ) \
911 this->m_##name = _arg; \
921 #define itkGetEnumMacro(name, type) \
922 virtual type Get##name () const \
924 return this->m_##name; \
931 #define itkSetStringMacro(name) \
932 virtual void Set##name (const char *_arg) \
934 if ( _arg && ( _arg == this->m_##name ) ) { return; } \
937 this->m_##name = _arg; \
941 this->m_##name = ""; \
945 virtual void Set##name (const std::string & _arg) \
947 this->Set##name( _arg.c_str() ); \
955 #define itkGetStringMacro(name) \
956 virtual const char *Get##name () const \
958 return this->m_##name.c_str(); \
964 #define itkSetClampMacro(name, type, min, max) \
965 virtual void Set##name (type _arg) \
967 const type temp_extrema=( _arg < min ? min : ( _arg > max ? max : _arg ) );\
968 itkDebugMacro("setting " << #name " to " << _arg); \
970 CLANG_SUPPRESS_Wfloat_equal \
971 if ( this->m_##name != temp_extrema ) \
973 this->m_##name = temp_extrema; \
985 #define itkSetObjectMacro(name, type) \
986 virtual void Set##name (type * _arg) \
988 itkDebugMacro("setting " << #name " to " << _arg); \
990 CLANG_SUPPRESS_Wfloat_equal \
991 if ( this->m_##name != _arg ) \
993 this->m_##name = _arg; \
1025 #define itkGetConstObjectMacro(name, type) \
1026 virtual const type * Get##name () const \
1028 return this->m_##name.GetPointer(); \
1032 #if defined ( ITK_FUTURE_LEGACY_REMOVE )
1038 # define itkGetObjectMacro(name, type) \
1039 virtual type * Get##name () \
1041 purposeful_error("itkGetObjectMacro should be replaced with itkGetModifiableObjectMacro."); \
1044 # define itkGetModifiableObjectMacro(name, type) \
1045 virtual type * GetModifiable##name () \
1047 return this->m_##name.GetPointer(); \
1049 itkGetConstObjectMacro(name, type)
1051 #else // defined ( ITK_FUTURE_LEGACY_REMOVE )
1054 # define itkGetObjectMacro(name, type) \
1055 virtual type * Get##name () \
1057 return this->m_##name.GetPointer(); \
1059 # define itkGetModifiableObjectMacro(name, type) \
1060 virtual type * GetModifiable##name () \
1062 return this->m_##name.GetPointer(); \
1064 itkGetConstObjectMacro(name, type) \
1065 itkGetObjectMacro(name, type)
1066 #endif // defined ( ITK_FUTURE_LEGACY_REMOVE )
1075 #define itkGetConstReferenceObjectMacro(name, type) \
1076 virtual const typename type::Pointer & Get##name () const \
1078 return this->m_##name; \
1085 #define itkSetConstObjectMacro(name, type) \
1086 virtual void Set##name (const type * _arg) \
1088 itkDebugMacro("setting " << #name " to " << _arg); \
1089 if ( this->m_##name != _arg ) \
1091 this->m_##name = _arg; \
1099 #define itkBooleanMacro(name) \
1100 virtual void name##On () \
1102 this->Set##name(true); \
1104 virtual void name##Off () \
1106 this->Set##name(false); \
1113 #define itkSetVectorMacro(name, type, count) \
1114 virtual void Set##name(type data[]) \
1117 for ( i = 0; i < count; i++ ) \
1119 if ( data[i] != this->m_##name[i] ) \
1127 for ( i = 0; i < count; i++ ) \
1129 this->m_##name[i] = data[i]; \
1137 #define itkGetVectorMacro(name, type, count) \
1138 virtual type * Get##name () const \
1140 return this->m_##name; \
1146 #define itkGPUKernelClassMacro(kernel) \
1150 static const char* GetOpenCLSource(); \
1153 virtual ~kernel(); \
1154 kernel(const kernel &); \
1155 void operator=(const kernel &); \
1159 #define itkGetOpenCLSourceFromKernelMacro(kernel) \
1160 static const char* GetOpenCLSource() \
1162 return kernel::GetOpenCLSource(); \
1167 #define itkPrintSelfObjectMacro(name) \
1168 if (static_cast<const LightObject*>(this->m_##name) == ITK_NULLPTR) \
1170 os << indent << #name << ": (null)" << std::endl; \
1174 os << indent << #name << ": " << std::endl; \
1175 this->m_##name->Print(os,indent.GetNextIndent()); \
1180 #define itkSetDecoratedOutputMacro(name, type) \
1181 virtual void Set##name##Output(const SimpleDataObjectDecorator< type > *_arg) \
1183 itkDebugMacro("setting output " #name " to " << _arg); \
1184 if ( _arg != itkDynamicCastInDebugMode< SimpleDataObjectDecorator< type > * >( this->ProcessObject::GetOutput(#name) ) ) \
1186 this->ProcessObject::SetOutput( #name, const_cast< SimpleDataObjectDecorator< type > * >( _arg ) ); \
1190 virtual void Set##name(const type &_arg) \
1192 typedef SimpleDataObjectDecorator< type > DecoratorType; \
1193 itkDebugMacro("setting output " #name " to " << _arg); \
1194 DecoratorType *output = itkDynamicCastInDebugMode< DecoratorType * >( \
1195 this->ProcessObject::GetOutput(#name) ); \
1198 if ( output->Get() == _arg ) \
1204 output->Set(_arg); \
1209 typename DecoratorType::Pointer newOutput = DecoratorType::New(); \
1210 newOutput->Set(_arg); \
1211 this->Set##name##Output(newOutput); \
1217 #define itkGetDecoratedOutputMacro(name, type) \
1218 virtual const SimpleDataObjectDecorator< type > * Get##name##Output() const \
1220 itkDebugMacro( "returning output " << #name " of " << this->ProcessObject::GetOutput(#name) ); \
1221 return itkDynamicCastInDebugMode< const SimpleDataObjectDecorator< type > * >( this->ProcessObject::GetOutput(#name) ); \
1223 virtual const type & Get##name() const \
1225 itkDebugMacro("Getting output " #name); \
1226 typedef SimpleDataObjectDecorator< type > DecoratorType; \
1227 const DecoratorType *output = \
1228 itkDynamicCastInDebugMode< const DecoratorType * >( \
1229 this->ProcessObject::GetOutput(#name) ); \
1230 if( output == ITK_NULLPTR ) \
1232 itkExceptionMacro(<<"output" #name " is not set"); \
1234 return output->Get(); \
1239 #endif //end of itkMacro.h