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
00249 #define itkSetEnumMacro(name,type) \
00250 virtual void Set##name (const type _arg) \
00251 { \
00252 itkDebugMacro("setting " #name " to " << static_cast<long>(_arg)); \
00253 if (this->m_##name != _arg) \
00254 { \
00255 this->m_##name = _arg; \
00256 this->Modified(); \
00257 } \
00258 }
00259
00260
00265 #define itkGetEnumMacro(name,type) \
00266 virtual type Get##name () const \
00267 { \
00268 itkDebugMacro("returning " << #name " of " << static_cast<long>(this->m_##name) ); \
00269 return this->m_##name; \
00270 }
00271
00272
00276 #define itkSetStringMacro(name) \
00277 virtual void Set##name (const char* _arg) \
00278 { \
00279 if ( _arg && (_arg == this->m_##name) ) { return;} \
00280 if (_arg) \
00281 { \
00282 this->m_##name = _arg;\
00283 } \
00284 else \
00285 { \
00286 this->m_##name = ""; \
00287 } \
00288 this->Modified(); \
00289 } \
00290 virtual void Set##name (const std::string & _arg) \
00291 { \
00292 this->Set##name( _arg.c_str() ); \
00293 } \
00294
00295
00296
00300 #define itkGetStringMacro(name) \
00301 virtual const char* Get##name () const \
00302 { \
00303 return this->m_##name.c_str(); \
00304 }
00305
00309 #define itkSetClampMacro(name,type,min,max) \
00310 virtual void Set##name (type _arg) \
00311 { \
00312 itkDebugMacro("setting " << #name " to " << _arg ); \
00313 if (this->m_##name != (_arg<min?min:(_arg>max?max:_arg))) \
00314 { \
00315 this->m_##name = (_arg<min?min:(_arg>max?max:_arg)); \
00316 this->Modified(); \
00317 } \
00318 }
00319
00320
00325 #define itkSetObjectMacro(name,type) \
00326 virtual void Set##name (type* _arg) \
00327 { \
00328 itkDebugMacro("setting " << #name " to " << _arg ); \
00329 if (this->m_##name != _arg) \
00330 { \
00331 this->m_##name = _arg; \
00332 this->Modified(); \
00333 } \
00334 }
00335
00336
00339 #define itkGetObjectMacro(name,type) \
00340 virtual type * Get##name () \
00341 { \
00342 itkDebugMacro("returning " #name " address " << this->m_##name ); \
00343 return this->m_##name.GetPointer(); \
00344 }
00345
00346
00351 #define itkSetConstObjectMacro(name,type) \
00352 virtual void Set##name (const type* _arg) \
00353 { \
00354 itkDebugMacro("setting " << #name " to " << _arg ); \
00355 if (this->m_##name != _arg) \
00356 { \
00357 this->m_##name = _arg; \
00358 this->Modified(); \
00359 } \
00360 }
00361
00362
00363
00366 #define itkGetConstObjectMacro(name,type) \
00367 virtual const type * Get##name () const \
00368 { \
00369 itkDebugMacro("returning " #name " address " << this->m_##name ); \
00370 return this->m_##name.GetPointer(); \
00371 }
00372
00373
00376 #define itkGetConstReferenceObjectMacro(name,type) \
00377 virtual const typename type::Pointer & Get##name () const \
00378 { \
00379 itkDebugMacro("returning " #name " address " << this->m_##name ); \
00380 return this->m_##name; \
00381 }
00382
00383
00386 #define itkBooleanMacro(name) \
00387 virtual void name##On () { this->Set##name(true);} \
00388 virtual void name##Off () { this->Set##name(false);}
00389
00390
00394 #define itkSetVectorMacro(name,type,count) \
00395 virtual void Set##name(type data[]) \
00396 { \
00397 unsigned int i; \
00398 for (i=0; i<count; i++) { if ( data[i] != this->m_##name[i] ) { break; }} \
00399 if ( i < count ) \
00400 { \
00401 this->Modified(); \
00402 for (i=0; i<count; i++) { this->m_##name[i] = data[i]; }\
00403 } \
00404 }
00405
00406
00409 #define itkGetVectorMacro(name,type,count) \
00410 virtual type *Get##name () const \
00411 { \
00412 return this->m_##name; \
00413 }
00414
00431 #define itkNewMacro(x) \
00432 static Pointer New(void) \
00433 { \
00434 Pointer smartPtr = ::itk::ObjectFactory<x>::Create(); \
00435 if(smartPtr.GetPointer() == NULL) \
00436 { \
00437 smartPtr = new x; \
00438 } \
00439 smartPtr->UnRegister(); \
00440 return smartPtr; \
00441 } \
00442 virtual ::itk::LightObject::Pointer CreateAnother(void) const \
00443 { \
00444 ::itk::LightObject::Pointer smartPtr; \
00445 smartPtr = x::New().GetPointer(); \
00446 return smartPtr; \
00447 }
00448
00449
00450
00467 #define itkFactorylessNewMacro(x) \
00468 static Pointer New(void) \
00469 { \
00470 Pointer smartPtr; \
00471 x *rawPtr = new x; \
00472 smartPtr = rawPtr; \
00473 rawPtr->UnRegister(); \
00474 return smartPtr; \
00475 } \
00476 virtual ::itk::LightObject::Pointer CreateAnother(void) const \
00477 { \
00478 ::itk::LightObject::Pointer smartPtr; \
00479 smartPtr = x::New().GetPointer(); \
00480 return smartPtr; \
00481 }
00482
00483
00486 #define itkTypeMacro(thisClass,superclass) \
00487 virtual const char *GetNameOfClass() const \
00488 {return #thisClass;}
00489
00490
00491 namespace itk
00492 {
00499 extern ITKCommon_EXPORT void OutputWindowDisplayText(const char*);
00500 extern ITKCommon_EXPORT void OutputWindowDisplayErrorText(const char*);
00501 extern ITKCommon_EXPORT void OutputWindowDisplayWarningText(const char*);
00502 extern ITKCommon_EXPORT void OutputWindowDisplayGenericOutputText(const char*);
00503 extern ITKCommon_EXPORT void OutputWindowDisplayDebugText(const char*);
00504 }
00506
00510 #if defined(ITK_LEAN_AND_MEAN) || defined(__BORLANDC__) || defined(NDEBUG)
00511 #define itkDebugMacro(x)
00512 #else
00513 #define itkDebugMacro(x) \
00514 { if (this->GetDebug() && ::itk::Object::GetGlobalWarningDisplay()) \
00515 { ::itk::OStringStream itkmsg; \
00516 itkmsg << "Debug: In " __FILE__ ", line " << __LINE__ << "\n" \
00517 << this->GetNameOfClass() << " (" << this << "): " x \
00518 << "\n\n"; \
00519 ::itk::OutputWindowDisplayDebugText(itkmsg.str().c_str());} \
00520 }
00521 #endif
00522
00523
00524
00528 #ifdef ITK_LEAN_AND_MEAN
00529 #define itkWarningMacro(x)
00530 #else
00531 #define itkWarningMacro(x) \
00532 { if (::itk::Object::GetGlobalWarningDisplay()) \
00533 { ::itk::OStringStream itkmsg; \
00534 itkmsg << "WARNING: In " __FILE__ ", line " << __LINE__ << "\n" \
00535 << this->GetNameOfClass() << " (" << this << "): " x \
00536 << "\n\n"; \
00537 ::itk::OutputWindowDisplayWarningText(itkmsg.str().c_str());} \
00538 }
00539 #endif
00540
00541
00542 namespace itk
00543 {
00544
00550 #if !defined(ITK_NO_ANSI_STRING_STREAM)
00551 class OStringStream: public std::ostringstream
00552 {
00553 public:
00554 OStringStream() {}
00555 private:
00556 OStringStream(const OStringStream&);
00557 void operator=(const OStringStream&);
00558 };
00559 #else
00560 namespace OStringStreamDetail
00561 {
00562 class Cleanup
00563 {
00564 public:
00565 Cleanup(std::ostrstream& ostr): m_OStrStream(ostr) {}
00566 ~Cleanup() { m_OStrStream.rdbuf()->freeze(0); }
00567 static void IgnoreUnusedVariable(const Cleanup&) {}
00568 protected:
00569 std::ostrstream& m_OStrStream;
00570 };
00571 }
00573
00574 class OStringStream: public std::ostrstream
00575 {
00576 public:
00577 typedef std::ostrstream Superclass;
00578 OStringStream() {}
00579 std::string str()
00580 {
00581 OStringStreamDetail::Cleanup cleanup(*this);
00582 OStringStreamDetail::Cleanup::IgnoreUnusedVariable(cleanup);
00583 int pcount = this->pcount();
00584 const char* ptr = this->Superclass::str();
00585 return std::string(ptr?ptr:"", pcount);
00586 }
00587 private:
00588 OStringStream(const OStringStream&);
00589 void operator=(const OStringStream&);
00590 };
00591 #endif
00592
00593 }
00594
00595 #if defined(ITK_CPP_FUNCTION)
00596 #if defined(__BORLANDC__)
00597 #define ITK_LOCATION __FUNC__
00598 #elif defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(CABLE_CONFIGURATION) && !defined(CSWIG)
00599 #define ITK_LOCATION __FUNCSIG__
00600 #elif defined(__GNUC__)
00601 #define ITK_LOCATION __PRETTY_FUNCTION__
00602 #else
00603 #define ITK_LOCATION __FUNCTION__
00604 #endif
00605 #else
00606 #define ITK_LOCATION "unknown"
00607 #endif
00608
00609 #include "itkExceptionObject.h"
00610
00614 #define itkExceptionMacro(x) \
00615 { \
00616 ::itk::OStringStream message; \
00617 message << "itk::ERROR: " << this->GetNameOfClass() \
00618 << "(" << this << "): " x; \
00619 ::itk::ExceptionObject e_(__FILE__, __LINE__, message.str().c_str(),ITK_LOCATION); \
00620 throw e_; \
00621 }
00622
00623
00624 #define itkGenericExceptionMacro(x) \
00625 { \
00626 ::itk::OStringStream message; \
00627 message << "itk::ERROR: " x; \
00628 ::itk::ExceptionObject e_(__FILE__, __LINE__, message.str().c_str(),ITK_LOCATION); \
00629 throw e_; \
00630 }
00631
00632 #ifdef ITK_LEAN_AND_MEAN
00633 #define itkGenericOutputMacro(x)
00634 #else
00635 #define itkGenericOutputMacro(x) \
00636 { if (::itk::Object::GetGlobalWarningDisplay()) \
00637 { ::itk::OStringStream itkmsg; \
00638 itkmsg << "WARNING: In " __FILE__ ", line " << __LINE__ << "\n" \
00639 x << "\n\n"; \
00640 ::itk::OutputWindowDisplayGenericOutputText(itkmsg.str().c_str());} \
00641 }
00642 #endif
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