00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00045 #ifndef __igtlMacro_h
00046 #define __igtlMacro_h
00047
00048 #include "igtlWin32Header.h"
00049
00050
00051 #include <string>
00052
00053
00054 #if !defined(CMAKE_NO_ANSI_STRING_STREAM)
00055 # include <sstream>
00056 #elif !defined(CMAKE_NO_ANSI_STREAM_HEADERS)
00057 # include <strstream>
00058 # define IGTL_NO_ANSI_STRING_STREAM
00059 #else
00060 # include <strstream.h>
00061 # define IGTL_NO_ANSI_STRING_STREAM
00062 #endif
00063
00068 namespace igtl
00069 {
00070 }
00071
00074 #define igtlNotUsed(x)
00075
00090 #if defined(_MSC_VER) && (_MSC_VER <= 1300)
00091 # define IGTL_NO_INCLASS_MEMBER_INITIALIZATION
00092 #endif
00093 #if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x540)
00094 # define IGTL_NO_INCLASS_MEMBER_INITIALIZATION
00095 #endif
00096 #if defined(__SVR4) && !defined(__SUNPRO_CC)
00097 # define IGTL_NO_INCLASS_MEMBER_INITIALIZATION
00098 #endif
00099
00100
00101
00102
00103
00104
00105
00106
00107 #if defined(__GNUC__)
00108 # define IGTL_NO_SIZEOF_CONSTANT_LOOKUP
00109 #endif
00110
00111 #if defined(_MSC_VER) && (_MSC_VER <= 1300)
00112 #define IGTL_NO_SELF_AS_TRAIT_IN_TEMPLATE_ARGUMENTS
00113 #endif
00114
00115 #if defined(IGTL_NO_INCLASS_MEMBER_INITIALIZATION) || \
00116 defined(IGTL_NO_SIZEOF_CONSTANT_LOOKUP)
00117 # define igtlStaticConstMacro(name,type,value) enum { name = value }
00118 #else
00119 # define igtlStaticConstMacro(name,type,value) static const type name = value
00120 #endif
00121
00122 #ifdef IGTL_NO_SELF_AS_TRAIT_IN_TEMPLATE_ARGUMENTS
00123 # define igtlGetStaticConstMacro(name) name
00124 #else
00125 # define igtlGetStaticConstMacro(name) (Self::name)
00126 #endif
00127
00129 #define igtlSetInputMacro(name, type, number) \
00130 virtual void Set##name##Input(const type *_arg) \
00131 { \
00132 igtlDebugMacro("setting input " #name " to " << _arg); \
00133 if (_arg != static_cast<type *>(this->ProcessObject::GetInput( number ))) \
00134 { \
00135 this->ProcessObject::SetNthInput( number, const_cast<type *>(_arg) ); \
00136 } \
00137 } \
00138 virtual void SetInput##number(const type *_arg) \
00139 { \
00140 igtlDebugMacro("setting input " #number " to " << _arg); \
00141 if (_arg != static_cast<type *>(this->ProcessObject::GetInput( number ))) \
00142 { \
00143 this->ProcessObject::SetNthInput( number, const_cast<type *>(_arg) ); \
00144 } \
00145 }
00146
00147
00149 #define igtlSuperclassTraitMacro(traitnameType) \
00150 typedef typename Superclass::traitnameType traitnameType;
00151
00153 #define igtlGetInputMacro(name, type, number) \
00154 virtual const type * Get##name##Input() const \
00155 { \
00156 igtlDebugMacro("returning input " << #name " of " << static_cast<const type *>(this->ProcessObject::GetInput( number )) ); \
00157 return static_cast<const type *>(this->ProcessObject::GetInput( number )); \
00158 } \
00159 virtual const type * GetInput##number() const \
00160 { \
00161 igtlDebugMacro("returning input " << #number " of " << static_cast<const type *>(this->ProcessObject::GetInput( number )) ); \
00162 return static_cast<const type *>(this->ProcessObject::GetInput( number )); \
00163 }
00164
00165
00168 #define igtlSetDecoratedInputMacro(name, type, number) \
00169 igtlSetInputMacro(name, SimpleDataObjectDecorator<type>, number); \
00170 igtlGetInputMacro(name, SimpleDataObjectDecorator<type>, number); \
00171 virtual void Set##name(const type &_arg) \
00172 { \
00173 typedef SimpleDataObjectDecorator< type > DecoratorType; \
00174 igtlDebugMacro("setting input " #name " to " << _arg); \
00175 const DecoratorType * oldInput = \
00176 static_cast< const DecoratorType * >( \
00177 this->ProcessObject::GetInput(number) ); \
00178 if( oldInput && oldInput->Get() == _arg ) \
00179 { \
00180 return; \
00181 } \
00182 typename DecoratorType::Pointer newInput = DecoratorType::New(); \
00183 newInput->Set( _arg ); \
00184 this->Set##name##Input( newInput ); \
00185 }
00186
00187
00191 #define igtlSetDecoratedObjectInputMacro(name, type, number) \
00192 igtlSetInputMacro(name, DataObjectDecorator<type>, number); \
00193 igtlGetInputMacro(name, DataObjectDecorator<type>, number); \
00194 virtual void Set##name(const type *_arg) \
00195 { \
00196 typedef DataObjectDecorator< type > DecoratorType; \
00197 igtlDebugMacro("setting input " #name " to " << _arg); \
00198 const DecoratorType * oldInput = \
00199 static_cast< const DecoratorType * >( \
00200 this->ProcessObject::GetInput(number) ); \
00201 if( oldInput && oldInput->Get() == _arg ) \
00202 { \
00203 return; \
00204 } \
00205 typename DecoratorType::Pointer newInput = DecoratorType::New(); \
00206 newInput->Set( _arg ); \
00207 this->Set##name##Input( newInput ); \
00208 }
00209
00210
00211
00213 #define igtlSetMacro(name,type) \
00214 virtual void Set##name (const type _arg) \
00215 { \
00216 igtlDebugMacro("setting " #name " to " << _arg); \
00217 if (this->m_##name != _arg) \
00218 { \
00219 this->m_##name = _arg; \
00220 } \
00221 }
00222
00223
00225 #define igtlGetMacro(name,type) \
00226 virtual type Get##name () \
00227 { \
00228 igtlDebugMacro("returning " << #name " of " << this->m_##name ); \
00229 return this->m_##name; \
00230 }
00231
00232
00236 #define igtlGetConstMacro(name,type) \
00237 virtual type Get##name () const \
00238 { \
00239 igtlDebugMacro("returning " << #name " of " << this->m_##name ); \
00240 return this->m_##name; \
00241 }
00242
00243
00248 #define igtlGetConstReferenceMacro(name,type) \
00249 virtual const type & Get##name () const \
00250 { \
00251 igtlDebugMacro("returning " << #name " of " << this->m_##name ); \
00252 return this->m_##name; \
00253 }
00254
00255
00259 #define igtlSetEnumMacro(name,type) \
00260 virtual void Set##name (const type _arg) \
00261 { \
00262 igtlDebugMacro("setting " #name " to " << static_cast<long>(_arg)); \
00263 if (this->m_##name != _arg) \
00264 { \
00265 this->m_##name = _arg; \
00266 } \
00267 }
00268
00269
00273 #define igtlGetEnumMacro(name,type) \
00274 virtual type Get##name () const \
00275 { \
00276 igtlDebugMacro("returning " << #name " of " << static_cast<long>(this->m_##name) ); \
00277 return this->m_##name; \
00278 }
00279
00280
00284 #define igtlSetStringMacro(name) \
00285 virtual void Set##name (const char* _arg) \
00286 { \
00287 if ( _arg && (_arg == this->m_##name) ) { return;} \
00288 if (_arg) \
00289 { \
00290 this->m_##name = _arg;\
00291 } \
00292 else \
00293 { \
00294 this->m_##name = ""; \
00295 } \
00296 } \
00297 virtual void Set##name (const std::string & _arg) \
00298 { \
00299 this->Set##name( _arg.c_str() ); \
00300 } \
00301
00302
00303
00307 #define igtlGetStringMacro(name) \
00308 virtual const char* Get##name () const \
00309 { \
00310 return this->m_##name.c_str(); \
00311 }
00312
00316 #define igtlSetClampMacro(name,type,min,max) \
00317 virtual void Set##name (type _arg) \
00318 { \
00319 igtlDebugMacro("setting " << #name " to " << _arg ); \
00320 if (this->m_##name != (_arg<min?min:(_arg>max?max:_arg))) \
00321 { \
00322 this->m_##name = (_arg<min?min:(_arg>max?max:_arg)); \
00323 } \
00324 }
00325
00326
00331 #define igtlSetObjectMacro(name,type) \
00332 virtual void Set##name (type* _arg) \
00333 { \
00334 igtlDebugMacro("setting " << #name " to " << _arg ); \
00335 if (this->m_##name != _arg) \
00336 { \
00337 this->m_##name = _arg; \
00338 } \
00339 }
00340
00341
00344 #define igtlGetObjectMacro(name,type) \
00345 virtual type * Get##name () \
00346 { \
00347 igtlDebugMacro("returning " #name " address " << this->m_##name ); \
00348 return this->m_##name.GetPointer(); \
00349 }
00350
00351
00356 #define igtlSetConstObjectMacro(name,type) \
00357 virtual void Set##name (const type* _arg) \
00358 { \
00359 igtlDebugMacro("setting " << #name " to " << _arg ); \
00360 if (this->m_##name != _arg) \
00361 { \
00362 this->m_##name = _arg; \
00363 } \
00364 }
00365
00366
00367
00370 #define igtlGetConstObjectMacro(name,type) \
00371 virtual const type * Get##name () const \
00372 { \
00373 igtlDebugMacro("returning " #name " address " << this->m_##name ); \
00374 return this->m_##name.GetPointer(); \
00375 }
00376
00377
00380 #define igtlGetConstReferenceObjectMacro(name,type) \
00381 virtual const typename type::Pointer & Get##name () const \
00382 { \
00383 igtlDebugMacro("returning " #name " address " << this->m_##name ); \
00384 return this->m_##name; \
00385 }
00386
00387
00390 #define igtlBooleanMacro(name) \
00391 virtual void name##On () { this->Set##name(true);} \
00392 virtual void name##Off () { this->Set##name(false);}
00393
00394
00398 #define igtlSetVectorMacro(name,type,count) \
00399 virtual void Set##name(type data[]) \
00400 { \
00401 unsigned int i; \
00402 for (i=0; i<count; i++) { if ( data[i] != this->m_##name[i] ) { break; }} \
00403 if ( i < count ) \
00404 { \
00405 for (i=0; i<count; i++) { this->m_##name[i] = data[i]; }\
00406 } \
00407 }
00408
00409
00412 #define igtlGetVectorMacro(name,type,count) \
00413 virtual type *Get##name () const \
00414 { \
00415 return this->m_##name; \
00416 }
00417
00434 #define igtlNewMacro(x) \
00435 static Pointer New(void) \
00436 { \
00437 Pointer smartPtr = ::igtl::ObjectFactory<x>::Create(); \
00438 if(smartPtr.GetPointer() == NULL) \
00439 { \
00440 smartPtr = new x; \
00441 } \
00442 smartPtr->UnRegister(); \
00443 return smartPtr; \
00444 } \
00445 virtual ::igtl::LightObject::Pointer CreateAnother(void) const \
00446 { \
00447 ::igtl::LightObject::Pointer smartPtr; \
00448 smartPtr = x::New().GetPointer(); \
00449 return smartPtr; \
00450 }
00451
00452
00453
00470 #define igtlFactorylessNewMacro(x) \
00471 static Pointer New(void) \
00472 { \
00473 Pointer smartPtr; \
00474 x *rawPtr = new x; \
00475 smartPtr = rawPtr; \
00476 rawPtr->UnRegister(); \
00477 return smartPtr; \
00478 } \
00479 virtual ::igtl::LightObject::Pointer CreateAnother(void) const \
00480 { \
00481 ::igtl::LightObject::Pointer smartPtr; \
00482 smartPtr = x::New().GetPointer(); \
00483 return smartPtr; \
00484 }
00485
00486
00489 #define igtlTypeMacro(thisClass,superclass) \
00490 virtual const char *GetNameOfClass() const \
00491 {return #thisClass;}
00492
00493
00494
00495
00502
00503
00504
00505
00506
00507
00509
00513 #if defined(IGTL_LEAN_AND_MEAN) || defined(__BORLANDC__)
00514 #define igtlDebugMacro(x)
00515 #else
00516 #define igtlDebugMacro(x) \
00517 { if (this->GetDebug() ) \
00518 { ::igtl::OStringStream igtlmsg; \
00519 igtlmsg << "Debug: In " __FILE__ ", line " << __LINE__ << "\n" \
00520 << this->GetNameOfClass() << " (" << this << "): " x \
00521 << "\n\n"; \
00522 std::cerr << igtlmsg.str(); } \
00523 }
00524 #endif
00525
00526
00527
00531 #ifdef IGTL_LEAN_AND_MEAN
00532 #define igtlWarningMacro(x)
00533 #else
00534 #define igtlWarningMacro(x) \
00535 { if ( 1) \
00536 { ::igtl::OStringStream igtlmsg; \
00537 igtlmsg << "WARNING: In " __FILE__ ", line " << __LINE__ << "\n" \
00538 << this->GetNameOfClass() << " (" << this << "): " x \
00539 << "\n\n"; \
00540 std::cerr << igtlmsg.str(); } \
00541 }
00542 #endif
00543
00544
00545 namespace igtl
00546 {
00547
00553 #if !defined(IGTL_NO_ANSI_STRING_STREAM)
00554 class OStringStream: public std::ostringstream
00555 {
00556 public:
00557 OStringStream() {}
00558 private:
00559 OStringStream(const OStringStream&);
00560 void operator=(const OStringStream&);
00561 };
00562 #else
00563 namespace OStringStreamDetail
00564 {
00565 class Cleanup
00566 {
00567 public:
00568 Cleanup(std::ostrstream& ostr): m_OStrStream(ostr) {}
00569 ~Cleanup() { m_OStrStream.rdbuf()->freeze(0); }
00570 static void IgnoreUnusedVariable(const Cleanup&) {}
00571 protected:
00572 std::ostrstream& m_OStrStream;
00573 };
00574 }
00576
00577 class OStringStream: public std::ostrstream
00578 {
00579 public:
00580 typedef std::ostrstream Superclass;
00581 OStringStream() {}
00582 std::string str()
00583 {
00584 OStringStreamDetail::Cleanup cleanup(*this);
00585 OStringStreamDetail::Cleanup::IgnoreUnusedVariable(cleanup);
00586 int pcount = this->pcount();
00587 const char* ptr = this->Superclass::str();
00588 return std::string(ptr?ptr:"", pcount);
00589 }
00590 private:
00591 OStringStream(const OStringStream&);
00592 void operator=(const OStringStream&);
00593 };
00594 #endif
00595
00596 }
00597
00598 #if defined(IGTL_CPP_FUNCTION)
00599 #if defined(__BORLANDC__)
00600 #define IGTL_LOCATION __FUNC__
00601 #elif defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(CABLE_CONFIGURATION) && !defined(CSWIG)
00602 #define IGTL_LOCATION __FUNCSIG__
00603 #elif defined(__GNUC__)
00604 #define IGTL_LOCATION __PRETTY_FUNCTION__
00605 #else
00606 #define IGTL_LOCATION __FUNCTION__
00607 #endif
00608 #else
00609 #define IGTL_LOCATION "unknown"
00610 #endif
00611
00612 #define igtlExceptionMacro(x) \
00613 { \
00614 ::igtl::OStringStream igtlmsg; \
00615 igtlmsg << "Debug: In " __FILE__ ", line " << __LINE__ << "\n" \
00616 << this->GetNameOfClass() << " (" << this << "): " x \
00617 << "\n\n"; \
00618 std::cerr << igtlmsg.str(); \
00619 }
00620
00621 #define igtlErrorMacro(x) \
00622 { \
00623 ::igtl::OStringStream igtlmsg; \
00624 igtlmsg << "Debug: In " __FILE__ ", line " << __LINE__ << "\n" \
00625 << this->GetNameOfClass() << " (" << this << "): " x \
00626 << "\n\n"; \
00627 std::cerr << igtlmsg.str(); \
00628 }
00629
00630
00631 #ifdef IGTL_LEAN_AND_MEAN
00632 #define igtlGenericOutputMacro(x)
00633 #else
00634 #define igtlGenericOutputMacro(x) \
00635 { if (1) \
00636 { ::igtl::OStringStream igtlmsg; \
00637 igtlmsg << "WARNING: In " __FILE__ ", line " << __LINE__ << "\n" \
00638 x << "\n\n"; \
00639 std::cerr << igtlmsg.str();} \
00640 }
00641 #endif
00642
00643
00644
00645
00646
00647
00648 #define igtlLogMacro( x, y) \
00649 { \
00650 if (this->GetLogger() ) \
00651 { \
00652 this->GetLogger()->Write(::igtl::LoggerBase::x, y); \
00653 } \
00654 }
00655
00656
00657 #define igtlLogMacroStatic( obj, x, y) \
00658 { \
00659 if (obj->GetLogger() ) \
00660 { \
00661 obj->GetLogger()->Write(::igtl::LoggerBase::x, y); \
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
00689 #if defined(IGTL_LEGACY_REMOVE)
00690
00691
00692
00693
00694 # define igtlLegacyMacro(method) class igtlLegacyMethodRemoved
00695 #elif defined(IGTL_LEGACY_SILENT) || defined(IGTL_LEGACY_TEST) || defined(CSWIG)
00696
00697 # define igtlLegacyMacro(method) method
00698 #else
00699
00700
00701 # if defined(__GNUC__) && !defined(__INTEL_COMPILER) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
00702 # define igtlLegacyMacro(method) method __attribute__((deprecated))
00703 # elif defined(_MSC_VER) && _MSC_VER >= 1300
00704 # define igtlLegacyMacro(method) __declspec(deprecated) method
00705 # else
00706 # define igtlLegacyMacro(method) method
00707 # endif
00708 #endif
00709
00710
00711
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722
00723 #if defined(IGTL_LEGACY_REMOVE) || defined(IGTL_LEGACY_SILENT)
00724 # define igtlLegacyBodyMacro(method, version)
00725 # define igtlLegacyReplaceBodyMacro(method, version, replace)
00726 #else
00727 # define igtlLegacyBodyMacro(method, version) \
00728 igtlWarningMacro(#method " was deprecated for IGTL " #version " and will be removed in a future version.")
00729 # define igtlLegacyReplaceBodyMacro(method, version, replace) \
00730 igtlWarningMacro(#method " was deprecated for IGTL " #version " and will be removed in a future version. Use " #replace " instead.")
00731 #endif
00732
00733 #if defined(__INTEL_COMPILER)
00734 # pragma warning (disable: 193)
00735 #endif
00736
00737
00738
00739
00740
00741
00742
00743
00744
00745
00746
00747 #if defined(__sgi) && defined(_COMPILER_VERSION)
00748 # define IGTL_TEMPLATE_DO_NOT_INSTANTIATE 1
00749 #elif defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 700
00750 # define IGTL_TEMPLATE_EXTERN 1
00751 #elif defined(__GNUC__) && __GNUC__ >= 3
00752 # define IGTL_TEMPLATE_EXTERN 1
00753 #elif defined(_MSC_VER) && _MSC_VER >= 1300
00754 # define IGTL_TEMPLATE_EXTERN 1
00755 #endif
00756 #if !defined(IGTL_TEMPLATE_DO_NOT_INSTANTIATE)
00757 # define IGTL_TEMPLATE_DO_NOT_INSTANTIATE 0
00758 #endif
00759 #if !defined(IGTL_TEMPLATE_EXTERN)
00760 # define IGTL_TEMPLATE_EXTERN 0
00761 #endif
00762
00763
00764
00765
00766
00767
00768
00769
00770 #define IGTL_TEMPLATE_EXPORT(x) IGTL_TEMPLATE_EXPORT_DELAY(x)
00771 #define IGTL_TEMPLATE_EXPORT_DELAY(x) template IGTL_TEMPLATE_##x;
00772
00773
00774
00775
00776
00777
00778
00779
00780
00781 #if IGTL_TEMPLATE_EXTERN
00782 # define IGTL_TEMPLATE_IMPORT_DELAY(x) extern template IGTL_TEMPLATE_##x;
00783 # if defined(_MSC_VER)
00784 # pragma warning (disable: 4231)
00785 # endif
00786 #elif IGTL_TEMPLATE_DO_NOT_INSTANTIATE
00787 # define IGTL_TEMPLATE_IMPORT_DELAY(x) \
00788 IGTL_TEMPLATE_IMPORT_IMPL(do_not_instantiate IGTL_TEMPLATE_##x)
00789 # define IGTL_TEMPLATE_IMPORT_IMPL(x) _Pragma(#x)
00790 #endif
00791 #if defined(IGTL_TEMPLATE_IMPORT_DELAY)
00792 # define IGTL_TEMPLATE_IMPORT(x) IGTL_TEMPLATE_IMPORT_DELAY(x)
00793 # define IGTL_TEMPLATE_IMPORT_WORKS 1
00794 #else
00795 # define IGTL_TEMPLATE_IMPORT(x)
00796 # define IGTL_TEMPLATE_IMPORT_WORKS 0
00797 #endif
00798
00799
00800
00801
00802
00803
00804
00805
00806
00807
00808
00809
00810
00811
00812
00813
00814
00815
00816
00817
00818
00819
00820
00821
00822
00823
00824
00825
00826
00827
00828
00829
00830
00831
00832
00833
00834
00835
00836
00837
00838
00839
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853
00854
00855 #define IGTL_EXPORT_TEMPLATE(EXPORT, c, x, y) \
00856 IGTL_TEMPLATE_##c(IGTL_TEMPLATE_EXPORT, EXPORT IGTL_EMPTY, x, y)
00857 #define IGTL_IMPORT_TEMPLATE(EXPORT, c, x, y) \
00858 IGTL_TEMPLATE_##c(IGTL_TEMPLATE_IMPORT, EXPORT IGTL_EMPTY, x, y)
00859 #define IGTL_EMPTY
00860
00861
00862
00863
00864
00865 #define IGTL_TEMPLATE_1(x1) x1
00866 #define IGTL_TEMPLATE_2(x1,x2) x1,x2
00867 #define IGTL_TEMPLATE_3(x1,x2,x3) x1,x2,x3
00868 #define IGTL_TEMPLATE_4(x1,x2,x3,x4) x1,x2,x3,x4
00869 #define IGTL_TEMPLATE_5(x1,x2,x3,x4,x5) x1,x2,x3,x4,x5
00870 #define IGTL_TEMPLATE_6(x1,x2,x3,x4,x5,x6) x1,x2,x3,x4,x5,x6
00871 #define IGTL_TEMPLATE_7(x1,x2,x3,x4,x5,x6,x7) x1,x2,x3,x4,x5,x6,x7
00872 #define IGTL_TEMPLATE_8(x1,x2,x3,x4,x5,x6,x7,x8) x1,x2,x3,x4,x5,x6,x7,x8
00873 #define IGTL_TEMPLATE_9(x1,x2,x3,x4,x5,x6,x7,x8,x9) x1,x2,x3,x4,x5,x6,x7,x8,x9
00874
00875
00876
00877
00878
00879
00880
00881
00882
00883 #if defined(IGTL_MANUAL_INSTANTIATION)
00884 # define IGTL_TEMPLATE_TXX 0
00885 #else
00886 # define IGTL_TEMPLATE_TXX !(IGTL_TEMPLATE_CXX || IGTL_TEMPLATE_TYPE)
00887 #endif
00888
00889
00890
00891
00892
00893
00894 #if IGTL_TEMPLATE_CXX
00895 # undef IGTL_MANUAL_INSTANTIATION
00896 # define IGTL_MANUAL_INSTANTIATION
00897 # if defined(_MSC_VER)
00898 # pragma warning (disable: 4275)
00899 # pragma warning (disable: 4661)
00900 # endif
00901 #endif
00902
00903
00904
00905
00906 #define IGTL_EXPORT_IGTLCommon(c, x, n) \
00907 IGTL_EXPORT_TEMPLATE(IGTLCommon_EXPORT, c, x, n)
00908 #define IGTL_IMPORT_IGTLCommon(c, x, n) \
00909 IGTL_IMPORT_TEMPLATE(IGTLCommon_EXPORT, c, x, n)
00910
00911
00912
00913
00914
00915
00916
00917
00918
00919
00920
00921
00922
00923
00924 #if IGTL_TEMPLATE_IMPORT_WORKS && defined(IGTL_EXPLICIT_INSTANTIATION)
00925 # define IGTL_TEMPLATE_EXPLICIT !IGTL_TEMPLATE_CXX
00926 #else
00927 # define IGTL_TEMPLATE_EXPLICIT 0
00928 #endif
00929
00930
00931
00932
00933
00934
00935
00936
00937 #if defined(__GNUC__)
00938 # if (((__GNUC__ == 2) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ >= 3))
00939 # define IGTL_NO_RETURN \
00940 __attribute__ ((noreturn))
00941 # endif
00942 #else
00943 # define IGTL_NO_RETURN
00944 #endif
00945
00946
00947 #ifdef IGTL_USE_TEMPLATE_META_PROGRAMMING_LOOP_UNROLLING
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958
00959 #define igtlFoorLoopAssignmentMacro(DestinationType,SourceType,DestinationElementType,DestinationArray,SourceArray,NumberOfIterations) \
00960 for(unsigned int i=0;i < NumberOfIterations; ++i) \
00961 { \
00962 DestinationArray[i] = static_cast< DestinationElementType >( SourceArray[i] ); \
00963 }
00964
00965
00966
00967
00968
00969
00970
00971
00972
00973 #define igtlFoorLoopRoundingAndAssignmentMacro(DestinationType,SourceType,DestinationElementType,DestinationArray,SourceArray,NumberOfIterations) \
00974 for(unsigned int i=0;i < NumberOfIterations; ++i) \
00975 { \
00976 DestinationArray[i] = static_cast< DestinationElementType >( vnl_math_rnd( SourceArray[i] ) ); \
00977 }
00978
00979 #endif
00980
00981
00982
00983 #endif //end of igtlMacro.h
00984