gdcmMacro.h

Go to the documentation of this file.
00001 /*=========================================================================
00002                                                                                 
00003   Program:   gdcm
00004   Module:    $RCSfile: gdcmMacro.h,v $
00005   Language:  C++
00006   Date:      $Date: 2007/08/22 16:14:04 $
00007   Version:   $Revision: 1.7 $
00008                                                                                 
00009   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
00010   l'Image). All rights reserved. See Doc/License.txt or
00011   http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
00012                                                                                 
00013      This software is distributed WITHOUT ANY WARRANTY; without even
00014      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00015      PURPOSE.  See the above copyright notices for more information.
00016                                                                                 
00017 =========================================================================*/
00018 
00019 #ifndef _GDCMMACRO_H_
00020 #define _GDCMMACRO_H_
00021 
00022 //-----------------------------------------------------------------------------
00023 #define gdcmTypeMacro(type)               \
00024    private :                              \
00025       type(type &); /* Not implemented */ \
00026       type &operator=(type &) /* Not implemented */
00027 
00028 #define gdcmNewMacro(type)                \
00029    public :                               \
00030       static type *New() {return new type(); } /* Not implemented */
00031 
00032 //-----------------------------------------------------------------------------
00033 //
00034 // Define GDCM_LEGACY macro to mark legacy methods where they are
00035 // declared in their class.
00036 //
00037 // WARNING : Don't try to use it with 'inline' methods !
00038 //
00039 //Example usage:
00040 //
00041 //   // @deprecated Replaced by MyOtherMethod() as of gdcm 2.0.
00042 //   GDCM_LEGACY(void MyMethod())
00043 #if defined(GDCM_LEGACY_REMOVE)
00044   // Remove legacy methods completely.
00045 # define GDCM_LEGACY(method)
00046 #elif defined(GDCM_LEGACY_SILENT)
00047   // Provide legacy methods with no warnings.
00048 # define GDCM_LEGACY(method) method;
00049 #else
00050   // Setup compile-time warnings for uses of deprecated methods if
00051   // possible on this compiler.
00052 # if defined(__GNUC__) && !defined(__INTEL_COMPILER) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
00053 #if defined(__APPLE__) && (__GNUC__ == 3) && (__GNUC_MINOR__ == 3)
00054 // Seems like there is a bug in APPLE gcc for deprecated attribute and ctor
00055 // This is fixed in g++ 4.0 (Tiger)
00056 #  define GDCM_LEGACY(method) method;
00057 #else
00058 #  define GDCM_LEGACY(method) method __attribute__((deprecated));
00059 #endif
00060 # elif defined(_MSC_VER) && _MSC_VER >= 1300
00061 #  define GDCM_LEGACY(method) __declspec(deprecated) method;
00062 # else
00063 #  define GDCM_LEGACY(method) method;
00064 # endif
00065 #endif
00066 
00067 // Macros to create runtime deprecation warning messages in function
00068 // bodies.  Example usage:
00069 //
00070 //   void MyClass::MyOldMethod()
00071 //   {
00072 //     GDCM_LEGACY_BODY(MyClass::MyOldMethod, 2.0);
00073 //   }
00074 //
00075 //   void MyClass::MyMethod()
00076 //   {
00077 //     GDCM_LEGACY_REPLACED_BODY(MyClass::MyMethod, 5.0,
00078 //                               MyClass::MyOtherMethod);
00079 //   }
00080 #if defined(GDCM_LEGACY_REMOVE) || defined(GDCM_LEGACY_SILENT)
00081 # define GDCM_LEGACY_BODY(method, version)
00082 # define GDCM_LEGACY_REPLACED_BODY(method, version, replace)
00083 #else
00084 # define GDCM_LEGACY_BODY(method, version) \
00085   gdcmWarningMacro(#method " was deprecated for gdcm" #version " and will be removed in a future version.")
00086 # define GDCM_LEGACY_REPLACED_BODY(method, version, replace) \
00087   gdcmWarningMacro(#method " was deprecated for gdcm" #version " and will be removed in a future version.  Use " #replace " instead.")
00088 #endif
00089 
00090 //-----------------------------------------------------------------------------
00091 #endif

Generated on Fri Aug 24 12:53:17 2007 for gdcm by  doxygen 1.4.6