00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00030 #ifndef __itkMacro_h
00031 #define __itkMacro_h
00032
00033 #include "itkWin32Header.h"
00034 #include "itkConfigure.h"
00035
00036 #include <string>
00037 #include <cstdlib>
00038
00039
00040 #if !defined(CMAKE_NO_ANSI_STRING_STREAM)
00041 # include <sstream>
00042 #elif !defined(CMAKE_NO_ANSI_STREAM_HEADERS)
00043 # include <strstream>
00044 # define ITK_NO_ANSI_STRING_STREAM
00045 #else
00046 # include <strstream.h>
00047 # define ITK_NO_ANSI_STRING_STREAM
00048 #endif
00049
00054 namespace itk
00055 {
00056 }
00057
00060 #define itkNotUsed(x)
00061
00076 #if defined(_MSC_VER) && (_MSC_VER <= 1300)
00077 # define ITK_NO_INCLASS_MEMBER_INITIALIZATION
00078 #endif
00079 #if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x540)
00080 # define ITK_NO_INCLASS_MEMBER_INITIALIZATION
00081 #endif
00082 #if defined(__SVR4) && !defined(__SUNPRO_CC)
00083 # define ITK_NO_INCLASS_MEMBER_INITIALIZATION
00084 #endif
00085
00086
00087
00088
00089
00090
00091
00092
00093 #if defined(__GNUC__)
00094 # define ITK_NO_SIZEOF_CONSTANT_LOOKUP
00095 #endif
00096
00097 #if defined(_MSC_VER) && (_MSC_VER <= 1300)
00098 #define ITK_NO_SELF_AS_TRAIT_IN_TEMPLATE_ARGUMENTS
00099 #endif
00100
00101 #if defined(ITK_NO_INCLASS_MEMBER_INITIALIZATION) || \
00102 defined(ITK_NO_SIZEOF_CONSTANT_LOOKUP)
00103 # define itkStaticConstMacro(name,type,value) enum { name = value }
00104 #else
00105 # define itkStaticConstMacro(name,type,value) static const type name = value
00106 #endif
00107
00108 #ifdef ITK_NO_SELF_AS_TRAIT_IN_TEMPLATE_ARGUMENTS
00109 # define itkGetStaticConstMacro(name) name
00110 #else
00111 # define itkGetStaticConstMacro(name) (Self::name)
00112 #endif
00113
00115 #define itkSetInputMacro(name, type, number) \
00116 virtual void Set##name##Input(const type *_arg) \
00117 { \
00118 itkDebugMacro("setting input " #name " to " << _arg); \
00119 if (_arg != static_cast<type *>(this->ProcessObject::GetInput( number ))) \
00120 { \
00121 this->ProcessObject::SetNthInput( number, const_cast<type *>(_arg) ); \
00122 this->Modified(); \
00123 } \
00124 } \
00125 virtual void SetInput##number(const type *_arg) \
00126 { \
00127 itkDebugMacro("setting input " #number " to " << _arg); \
00128 if (_arg != static_cast<type *>(this->ProcessObject::GetInput( number ))) \
00129 { \
00130 this->ProcessObject::SetNthInput( number, const_cast<type *>(_arg) ); \
00131 this->Modified(); \
00132 } \
00133 }
00134
00135
00137 #define itkSuperclassTraitMacro(traitnameType) \
00138 typedef typename Superclass::traitnameType traitnameType;
00139
00141 #define itkGetInputMacro(name, type, number) \
00142 virtual const type * Get##name##Input() const \
00143 { \
00144 itkDebugMacro("returning input " << #name " of " << static_cast<const type *>(this->ProcessObject::GetInput( number )) ); \
00145 return static_cast<const type *>(this->ProcessObject::GetInput( number )); \
00146 } \
00147 virtual const type * GetInput##number() const \
00148 { \
00149 itkDebugMacro("returning input " << #number " of " << static_cast<const type *>(this->ProcessObject::GetInput( number )) ); \
00150 return static_cast<const type *>(this->ProcessObject::GetInput( number )); \
00151 }
00152
00153
00156 #define itkSetDecoratedInputMacro(name, type, number) \
00157 itkSetInputMacro(name, SimpleDataObjectDecorator<type>, number); \
00158 itkGetInputMacro(name, SimpleDataObjectDecorator<type>, number); \
00159 virtual void Set##name(const type &_arg) \
00160 { \
00161 typedef SimpleDataObjectDecorator< type > DecoratorType; \
00162 itkDebugMacro("setting input " #name " to " << _arg); \
00163 const DecoratorType * oldInput = \
00164 static_cast< const DecoratorType * >( \
00165 this->ProcessObject::GetInput(number) ); \
00166 if( oldInput && oldInput->Get() == _arg ) \
00167 { \
00168 return; \
00169 } \
00170 typename DecoratorType::Pointer newInput = DecoratorType::New(); \
00171 newInput->Set( _arg ); \
00172 this->Set##name##Input( newInput ); \
00173 }
00174
00175
00179 #define itkSetDecoratedObjectInputMacro(name, type, number) \
00180 itkSetInputMacro(name, DataObjectDecorator<type>, number); \
00181 itkGetInputMacro(name, DataObjectDecorator<type>, number); \
00182 virtual void Set##name(const type *_arg) \
00183 { \
00184 typedef DataObjectDecorator< type > DecoratorType; \
00185 itkDebugMacro("setting input " #name " to " << _arg); \
00186 const DecoratorType * oldInput = \
00187 static_cast< const DecoratorType * >( \
00188 this->ProcessObject::GetInput(number) ); \
00189 if( oldInput && oldInput->Get() == _arg ) \
00190 { \
00191 return; \
00192 } \
00193 typename DecoratorType::Pointer newInput = DecoratorType::New(); \
00194 newInput->Set( _arg ); \
00195 this->Set##name##Input( newInput ); \
00196 }
00197
00198
00199
00201 #define itkSetMacro(name,type) \
00202 virtual void Set##name (const type _arg) \
00203 { \
00204 itkDebugMacro("setting " #name " to " << _arg); \
00205 if (this->m_##name != _arg) \
00206 { \
00207 this->m_##name = _arg; \
00208 this->Modified(); \
00209 } \
00210 }
00211
00212
00214 #define itkGetMacro(name,type) \
00215 virtual type Get##name () \
00216 { \
00217 itkDebugMacro("returning " << #name " of " << this->m_##name ); \
00218 return this->m_##name; \
00219 }
00220
00221
00225 #define itkGetConstMacro(name,type) \
00226 virtual type Get##name () const \
00227 { \
00228 itkDebugMacro("returning " << #name " of " << this->m_##name ); \
00229 return this->m_##name; \
00230 }
00231
00232
00237 #define itkGetConstReferenceMacro(name,type) \
00238 virtual const type & Get##name () const \
00239 { \
00240 itkDebugMacro("returning " << #name " of " << this->m_##name ); \
00241 return this->m_##name; \
00242 }
00243
00244
00248 #define itkSetEnumMacro(name,type) \
00249 virtual void Set##name (const type _arg) \
00250 { \
00251 itkDebugMacro("setting " #name " to " << static_cast<long>(_arg)); \
00252 if (this->m_##name != _arg) \
00253 { \
00254 this->m_##name = _arg; \
00255 this->Modified(); \
00256 } \
00257 }
00258
00259
00263 #define itkGetEnumMacro(name,type) \
00264 virtual type Get##name () const \
00265 { \
00266 itkDebugMacro("returning " << #name " of " << static_cast<long>(this->m_##name) ); \
00267 return this->m_##name; \
00268 }
00269
00270
00274 #define itkSetStringMacro(name) \
00275 virtual void Set##name (const char* _arg) \
00276 { \
00277 if ( _arg && (_arg == this->m_##name) ) { return;} \
00278 if (_arg) \
00279 { \
00280 this->m_##name = _arg;\
00281 } \
00282 else \
00283 { \
00284 this->m_##name = ""; \
00285 } \
00286 this->Modified(); \
00287 } \
00288 virtual void Set##name (const std::string & _arg) \
00289 { \
00290 this->Set##name( _arg.c_str() ); \
00291 } \
00292
00293
00294
00298 #define itkGetStringMacro(name) \
00299 virtual const char* Get##name () const \
00300 { \
00301 return this->m_##name.c_str(); \
00302 }
00303
00307 #define itkSetClampMacro(name,type,min,max) \
00308 virtual void Set##name (type _arg) \
00309 { \
00310 itkDebugMacro("setting " << #name " to " << _arg ); \
00311 if (this->m_##name != (_arg<min?min:(_arg>max?max:_arg))) \
00312 { \
00313 this->m_##name = (_arg<min?min:(_arg>max?max:_arg)); \
00314 this->Modified(); \
00315 } \
00316 }
00317
00318
00323 #define itkSetObjectMacro(name,type) \
00324 virtual void Set##name (type* _arg) \
00325 { \
00326 itkDebugMacro("setting " << #name " to " << _arg ); \
00327 if (this->m_##name != _arg) \
00328 { \
00329 this->m_##name = _arg; \
00330 this->Modified(); \
00331 } \
00332 }
00333
00334
00337 #define itkGetObjectMacro(name,type) \
00338 virtual type * Get##name () \
00339 { \
00340 itkDebugMacro("returning " #name " address " << this->m_##name ); \
00341 return this->m_##name.GetPointer(); \
00342 }
00343
00344
00349 #define itkSetConstObjectMacro(name,type) \
00350 virtual void Set##name (const type* _arg) \
00351 { \
00352 itkDebugMacro("setting " << #name " to " << _arg ); \
00353 if (this->m_##name != _arg) \
00354 { \
00355 this->m_##name = _arg; \
00356 this->Modified(); \
00357 } \
00358 }
00359
00360
00361
00364 #define itkGetConstObjectMacro(name,type) \
00365 virtual const type * Get##name () const \
00366 { \
00367 itkDebugMacro("returning " #name " address " << this->m_##name ); \
00368 return this->m_##name.GetPointer(); \
00369 }
00370
00371
00374 #define itkGetConstReferenceObjectMacro(name,type) \
00375 virtual const typename type::Pointer & Get##name () const \
00376 { \
00377 itkDebugMacro("returning " #name " address " << this->m_##name ); \
00378 return this->m_##name; \
00379 }
00380
00381
00384 #define itkBooleanMacro(name) \
00385 virtual void name##On () { this->Set##name(true);} \
00386 virtual void name##Off () { this->Set##name(false);}
00387
00388
00392 #define itkSetVectorMacro(name,type,count) \
00393 virtual void Set##name(type data[]) \
00394 { \
00395 unsigned int i; \
00396 for (i=0; i<count; i++) { if ( data[i] != this->m_##name[i] ) { break; }} \
00397 if ( i < count ) \
00398 { \
00399 this->Modified(); \
00400 for (i=0; i<count; i++) { this->m_##name[i] = data[i]; }\
00401 } \
00402 }
00403
00404
00407 #define itkGetVectorMacro(name,type,count) \
00408 virtual type *Get##name () const \
00409 { \
00410 return this->m_##name; \
00411 }
00412
00429 #define itkNewMacro(x) \
00430 static Pointer New(void) \
00431 { \
00432 Pointer smartPtr = ::itk::ObjectFactory<x>::Create(); \
00433 if(smartPtr.GetPointer() == NULL) \
00434 { \
00435 smartPtr = new x; \
00436 } \
00437 smartPtr->UnRegister(); \
00438 return smartPtr; \
00439 } \
00440 virtual ::itk::LightObject::Pointer CreateAnother(void) const \
00441 { \
00442 ::itk::LightObject::Pointer smartPtr; \
00443 smartPtr = x::New().GetPointer(); \
00444 return smartPtr; \
00445 }
00446
00447
00448
00465 #define itkFactorylessNewMacro(x) \
00466 static Pointer New(void) \
00467 { \
00468 Pointer smartPtr; \
00469 x *rawPtr = new x; \
00470 smartPtr = rawPtr; \
00471 rawPtr->UnRegister(); \
00472 return smartPtr; \
00473 } \
00474 virtual ::itk::LightObject::Pointer CreateAnother(void) const \
00475 { \
00476 ::itk::LightObject::Pointer smartPtr; \
00477 smartPtr = x::New().GetPointer(); \
00478 return smartPtr; \
00479 }
00480
00481
00484 #define itkTypeMacro(thisClass,superclass) \
00485 virtual const char *GetNameOfClass() const \
00486 {return #thisClass;}
00487
00488
00489 namespace itk
00490 {
00497 extern ITKCommon_EXPORT void OutputWindowDisplayText(const char*);
00498 extern ITKCommon_EXPORT void OutputWindowDisplayErrorText(const char*);
00499 extern ITKCommon_EXPORT void OutputWindowDisplayWarningText(const char*);
00500 extern ITKCommon_EXPORT void OutputWindowDisplayGenericOutputText(const char*);
00501 extern ITKCommon_EXPORT void OutputWindowDisplayDebugText(const char*);
00502 }
00504
00508 #if defined(ITK_LEAN_AND_MEAN) || defined(__BORLANDC__) || defined(NDEBUG)
00509 #define itkDebugMacro(x)
00510 #else
00511 #define itkDebugMacro(x) \
00512 { if (this->GetDebug() && ::itk::Object::GetGlobalWarningDisplay()) \
00513 { ::itk::OStringStream itkmsg; \
00514 itkmsg << "Debug: In " __FILE__ ", line " << __LINE__ << "\n" \
00515 << this->GetNameOfClass() << " (" << this << "): " x \
00516 << "\n\n"; \
00517 ::itk::OutputWindowDisplayDebugText(itkmsg.str().c_str());} \
00518 }
00519 #endif
00520
00521
00522
00526 #ifdef ITK_LEAN_AND_MEAN
00527 #define itkWarningMacro(x)
00528 #else
00529 #define itkWarningMacro(x) \
00530 { if (::itk::Object::GetGlobalWarningDisplay()) \
00531 { ::itk::OStringStream itkmsg; \
00532 itkmsg << "WARNING: In " __FILE__ ", line " << __LINE__ << "\n" \
00533 << this->GetNameOfClass() << " (" << this << "): " x \
00534 << "\n\n"; \
00535 ::itk::OutputWindowDisplayWarningText(itkmsg.str().c_str());} \
00536 }
00537 #endif
00538
00539
00540 namespace itk
00541 {
00542
00548 #if !defined(ITK_NO_ANSI_STRING_STREAM)
00549 class OStringStream: public std::ostringstream
00550 {
00551 public:
00552 OStringStream() {}
00553 private:
00554 OStringStream(const OStringStream&);
00555 void operator=(const OStringStream&);
00556 };
00557 #else
00558 namespace OStringStreamDetail
00559 {
00560 class Cleanup
00561 {
00562 public:
00563 Cleanup(std::ostrstream& ostr): m_OStrStream(ostr) {}
00564 ~Cleanup() { m_OStrStream.rdbuf()->freeze(0); }
00565 static void IgnoreUnusedVariable(const Cleanup&) {}
00566 protected:
00567 std::ostrstream& m_OStrStream;
00568 };
00569 }
00571
00572 class OStringStream: public std::ostrstream
00573 {
00574 public:
00575 typedef std::ostrstream Superclass;
00576 OStringStream() {}
00577 std::string str()
00578 {
00579 OStringStreamDetail::Cleanup cleanup(*this);
00580 OStringStreamDetail::Cleanup::IgnoreUnusedVariable(cleanup);
00581 int pcount = this->pcount();
00582 const char* ptr = this->Superclass::str();
00583 return std::string(ptr?ptr:"", pcount);
00584 }
00585 private:
00586 OStringStream(const OStringStream&);
00587 void operator=(const OStringStream&);
00588 };
00589 #endif
00590
00591 }
00592
00593 #if defined(ITK_CPP_FUNCTION)
00594 #if defined(__BORLANDC__)
00595 #define ITK_LOCATION __FUNC__
00596 #elif defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(CABLE_CONFIGURATION) && !defined(CSWIG)
00597 #define ITK_LOCATION __FUNCSIG__
00598 #elif defined(__GNUC__)
00599 #define ITK_LOCATION __PRETTY_FUNCTION__
00600 #else
00601 #define ITK_LOCATION __FUNCTION__
00602 #endif
00603 #else
00604 #define ITK_LOCATION "unknown"
00605 #endif
00606
00607 #include "itkExceptionObject.h"
00608
00612 #define itkExceptionMacro(x) \
00613 { \
00614 ::itk::OStringStream message; \
00615 message << "itk::ERROR: " << this->GetNameOfClass() \
00616 << "(" << this << "): " x; \
00617 ::itk::ExceptionObject e_(__FILE__, __LINE__, message.str().c_str(),ITK_LOCATION); \
00618 throw e_; \
00619 }
00620
00621
00622 #define itkGenericExceptionMacro(x) \
00623 { \
00624 ::itk::OStringStream message; \
00625 message << "itk::ERROR: " x; \
00626 ::itk::ExceptionObject e_(__FILE__, __LINE__, message.str().c_str(),ITK_LOCATION); \
00627 throw e_; \
00628 }
00629
00630 #ifdef ITK_LEAN_AND_MEAN
00631 #define itkGenericOutputMacro(x)
00632 #else
00633 #define itkGenericOutputMacro(x) \
00634 { if (::itk::Object::GetGlobalWarningDisplay()) \
00635 { ::itk::OStringStream itkmsg; \
00636 itkmsg << "WARNING: In " __FILE__ ", line " << __LINE__ << "\n" \
00637 x << "\n\n"; \
00638 ::itk::OutputWindowDisplayGenericOutputText(itkmsg.str().c_str());} \
00639 }
00640 #endif
00641
00642
00643
00644
00645
00646
00647 #define itkLogMacro( x, y) \
00648 { \
00649 if (this->GetLogger() ) \
00650 { \
00651 this->GetLogger()->Write(::itk::LoggerBase::x, y); \
00652 } \
00653 }
00654
00655
00656 #define itkLogMacroStatic( obj, x, y) \
00657 { \
00658 if (obj->GetLogger() ) \
00659 { \
00660 obj->GetLogger()->Write(::itk::LoggerBase::x, y); \
00661 } \
00662 }
00663
00664
00665
00666
00667
00668
00669
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679
00680
00681
00682
00683
00684
00685
00686
00687
00688 #if defined(ITK_LEGACY_REMOVE)
00689
00690
00691
00692
00693 # define itkLegacyMacro(method) class itkLegacyMethodRemoved
00694 #elif defined(ITK_LEGACY_SILENT) || defined(ITK_LEGACY_TEST) || defined(CSWIG)
00695
00696 # define itkLegacyMacro(method) method
00697 #else
00698
00699
00700 # if defined(__GNUC__) && !defined(__INTEL_COMPILER) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
00701 # define itkLegacyMacro(method) method __attribute__((deprecated))
00702 # elif defined(_MSC_VER) && _MSC_VER >= 1300
00703 # define itkLegacyMacro(method) __declspec(deprecated) method
00704 # else
00705 # define itkLegacyMacro(method) method
00706 # endif
00707 #endif
00708
00709
00710
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722 #if defined(ITK_LEGACY_REMOVE) || defined(ITK_LEGACY_SILENT)
00723 # define itkLegacyBodyMacro(method, version)
00724 # define itkLegacyReplaceBodyMacro(method, version, replace)
00725 # define itkGenericLegacyBodyMacro(method, version)
00726 # define itkGenericLegacyReplaceBodyMacro(method, version, replace)
00727 #else
00728 # define itkLegacyBodyMacro(method, version) \
00729 itkWarningMacro(#method " was deprecated for ITK " #version " and will be removed in a future version.")
00730 # define itkLegacyReplaceBodyMacro(method, version, replace) \
00731 itkWarningMacro(#method " was deprecated for ITK " #version " and will be removed in a future version. Use " #replace " instead.")
00732 # define itkGenericLegacyBodyMacro(method, version) \
00733 itkGenericOutputMacro(#method " was deprecated for ITK " #version " and will be removed in a future version.")
00734 # define itkGenericLegacyReplaceBodyMacro(method, version, replace) \
00735 itkGenericOutputMacro(#method " was deprecated for ITK " #version " and will be removed in a future version. Use " #replace " instead.")
00736 #endif
00737
00738 #if defined(__INTEL_COMPILER)
00739 # pragma warning (disable: 193)
00740 #endif
00741
00742
00743
00744
00745
00746
00747
00748
00749
00750
00751
00752
00753
00754
00755
00756
00757
00758
00759
00760
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770
00771 #if defined(ITK_SUPPORTS_TEMPLATED_FRIEND_FUNCTION_WITH_NULL_STRING)
00772 #define ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT(T)
00773 #else
00774 #if defined(ITK_SUPPORTS_TEMPLATED_FRIEND_FUNCTION_WITH_EMPTY_BRACKETS)
00775 #define ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT(T) <>
00776 #else
00777 #if defined(ITK_SUPPORTS_TEMPLATED_FRIEND_FUNCTION_WITH_TEMPLATE_ARGUMENTS)
00778 #define ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT(T) <T>
00779 #endif
00780 #endif
00781 #endif
00782
00783
00784
00785
00786
00787
00788
00789
00790
00791
00792
00793
00794 #if defined(__sgi) && defined(_COMPILER_VERSION)
00795 # define ITK_TEMPLATE_DO_NOT_INSTANTIATE 1
00796 #elif defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 700
00797 # define ITK_TEMPLATE_EXTERN 1
00798 #elif defined(__GNUC__) && __GNUC__ >= 3
00799 # define ITK_TEMPLATE_EXTERN 1
00800 #elif defined(_MSC_VER) && _MSC_VER >= 1300
00801 # define ITK_TEMPLATE_EXTERN 1
00802 #endif
00803 #if !defined(ITK_TEMPLATE_DO_NOT_INSTANTIATE)
00804 # define ITK_TEMPLATE_DO_NOT_INSTANTIATE 0
00805 #endif
00806 #if !defined(ITK_TEMPLATE_EXTERN)
00807 # define ITK_TEMPLATE_EXTERN 0
00808 #endif
00809
00810
00811
00812
00813
00814
00815
00816
00817 #define ITK_TEMPLATE_EXPORT(x) ITK_TEMPLATE_EXPORT_DELAY(x)
00818 #define ITK_TEMPLATE_EXPORT_DELAY(x) template ITK_TEMPLATE_##x;
00819
00820
00821
00822
00823
00824
00825
00826
00827
00828 #if ITK_TEMPLATE_EXTERN
00829 # define ITK_TEMPLATE_IMPORT_DELAY(x) extern template ITK_TEMPLATE_##x;
00830 # if defined(_MSC_VER)
00831 # pragma warning (disable: 4231)
00832 # endif
00833 #elif ITK_TEMPLATE_DO_NOT_INSTANTIATE
00834 # define ITK_TEMPLATE_IMPORT_DELAY(x) \
00835 ITK_TEMPLATE_IMPORT_IMPL(do_not_instantiate ITK_TEMPLATE_##x)
00836 # define ITK_TEMPLATE_IMPORT_IMPL(x) _Pragma(#x)
00837 #endif
00838 #if defined(ITK_TEMPLATE_IMPORT_DELAY)
00839 # define ITK_TEMPLATE_IMPORT(x) ITK_TEMPLATE_IMPORT_DELAY(x)
00840 # define ITK_TEMPLATE_IMPORT_WORKS 1
00841 #else
00842 # define ITK_TEMPLATE_IMPORT(x)
00843 # define ITK_TEMPLATE_IMPORT_WORKS 0
00844 #endif
00845
00846
00847
00848
00849
00850
00851
00852
00853
00854
00855
00856
00857
00858
00859
00860
00861
00862
00863
00864
00865
00866
00867
00868
00869
00870
00871
00872
00873
00874
00875
00876
00877
00878
00879
00880
00881
00882
00883
00884
00885
00886
00887
00888
00889
00890
00891
00892
00893
00894
00895
00896
00897
00898
00899
00900
00901
00902 #define ITK_EXPORT_TEMPLATE(EXPORT, c, x, y) \
00903 ITK_TEMPLATE_##c(ITK_TEMPLATE_EXPORT, EXPORT ITK_EMPTY, x, y)
00904 #define ITK_IMPORT_TEMPLATE(EXPORT, c, x, y) \
00905 ITK_TEMPLATE_##c(ITK_TEMPLATE_IMPORT, EXPORT ITK_EMPTY, x, y)
00906 #define ITK_EMPTY
00907
00908
00909
00910
00911
00912 #define ITK_TEMPLATE_1(x1) x1
00913 #define ITK_TEMPLATE_2(x1,x2) x1,x2
00914 #define ITK_TEMPLATE_3(x1,x2,x3) x1,x2,x3
00915 #define ITK_TEMPLATE_4(x1,x2,x3,x4) x1,x2,x3,x4
00916 #define ITK_TEMPLATE_5(x1,x2,x3,x4,x5) x1,x2,x3,x4,x5
00917 #define ITK_TEMPLATE_6(x1,x2,x3,x4,x5,x6) x1,x2,x3,x4,x5,x6
00918 #define ITK_TEMPLATE_7(x1,x2,x3,x4,x5,x6,x7) x1,x2,x3,x4,x5,x6,x7
00919 #define ITK_TEMPLATE_8(x1,x2,x3,x4,x5,x6,x7,x8) x1,x2,x3,x4,x5,x6,x7,x8
00920 #define ITK_TEMPLATE_9(x1,x2,x3,x4,x5,x6,x7,x8,x9) x1,x2,x3,x4,x5,x6,x7,x8,x9
00921
00922
00923
00924
00925
00926
00927
00928
00929
00930 #if defined(ITK_MANUAL_INSTANTIATION)
00931 # define ITK_TEMPLATE_TXX 0
00932 #else
00933 # define ITK_TEMPLATE_TXX !(ITK_TEMPLATE_CXX || ITK_TEMPLATE_TYPE)
00934 #endif
00935
00936
00937
00938
00939
00940
00941 #if ITK_TEMPLATE_CXX
00942 # undef ITK_MANUAL_INSTANTIATION
00943 # define ITK_MANUAL_INSTANTIATION
00944 # if defined(_MSC_VER)
00945 # pragma warning (disable: 4275)
00946 # pragma warning (disable: 4661)
00947 # endif
00948 #endif
00949
00950
00951
00952
00953 #define ITK_EXPORT_ITKCommon(c, x, n) \
00954 ITK_EXPORT_TEMPLATE(ITKCommon_EXPORT, c, x, n)
00955 #define ITK_IMPORT_ITKCommon(c, x, n) \
00956 ITK_IMPORT_TEMPLATE(ITKCommon_EXPORT, c, x, n)
00957
00958
00959
00960
00961
00962
00963
00964
00965
00966
00967
00968
00969
00970
00971 #if ITK_TEMPLATE_IMPORT_WORKS && defined(ITK_EXPLICIT_INSTANTIATION)
00972 # define ITK_TEMPLATE_EXPLICIT !ITK_TEMPLATE_CXX
00973 #else
00974 # define ITK_TEMPLATE_EXPLICIT 0
00975 #endif
00976
00977
00978
00979
00980
00981
00982
00983
00984 #if defined(__GNUC__)
00985 # if (((__GNUC__ == 2) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ >= 3))
00986 # define ITK_NO_RETURN \
00987 __attribute__ ((noreturn))
00988 # endif
00989 #else
00990 # define ITK_NO_RETURN
00991 #endif
00992
00993
00994 #ifdef ITK_USE_TEMPLATE_META_PROGRAMMING_LOOP_UNROLLING
00995
00996
00997
00998
00999
01000
01001
01002
01003
01004
01005
01006 #define itkFoorLoopAssignmentMacro(DestinationType,SourceType,DestinationElementType,DestinationArray,SourceArray,NumberOfIterations) \
01007 for(unsigned int i=0;i < NumberOfIterations; ++i) \
01008 { \
01009 DestinationArray[i] = static_cast< DestinationElementType >( SourceArray[i] ); \
01010 }
01011
01012
01013
01014
01015
01016
01017
01018
01019
01020 #define itkFoorLoopRoundingAndAssignmentMacro(DestinationType,SourceType,DestinationElementType,DestinationArray,SourceArray,NumberOfIterations) \
01021 for(unsigned int i=0;i < NumberOfIterations; ++i) \
01022 { \
01023 DestinationArray[i] = static_cast< DestinationElementType >( vnl_math_rnd( SourceArray[i] ) ); \
01024 }
01025
01026 #endif
01027
01028
01029
01030 #endif //end of itkMacro.h
01031