gdcmLegacyMacro.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program: GDCM (Grassroots DICOM). A DICOM library
00004   Module:  $URL$
00005 
00006   Copyright (c) 2006-2010 Mathieu Malaterre
00007   All rights reserved.
00008   See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00015 #ifndef GDCMLEGACYMACRO_H
00016 #define GDCMLEGACYMACRO_H
00017 
00018 #if !defined(GDCMTYPES_H) && !defined(SWIG)
00019 #error you need to include gdcmTypes.h instead
00020 #endif
00021 
00022 #include "gdcmException.h"
00023 #include "gdcmTrace.h"
00024 
00025 //----------------------------------------------------------------------------
00026 // Setup legacy code policy.
00027 
00028 // Define GDCM_LEGACY macro to mark legacy methods where they are
00029 // declared in their class.  Example usage:
00030 //
00031 //   // @deprecated Replaced by MyOtherMethod() as of GDCM 2.0.
00032 //   GDCM_LEGACY(void MyMethod());
00033 #if defined(GDCM_LEGACY_REMOVE)
00034 # define GDCM_LEGACY(method)
00035 #elif defined(GDCM_LEGACY_SILENT) || defined(SWIG)
00036   // Provide legacy methods with no warnings.
00037 # define GDCM_LEGACY(method) method;
00038 #else
00039   // Setup compile-time warnings for uses of deprecated methods if
00040   // possible on this compiler.
00041 # if defined(__GNUC__) && !defined(__INTEL_COMPILER) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
00042 #  define GDCM_LEGACY(method) method __attribute__((deprecated));
00043 # elif defined(_MSC_VER) && _MSC_VER >= 1300
00044 #  define GDCM_LEGACY(method) __declspec(deprecated) method;
00045 # else
00046 #  define GDCM_LEGACY(method) method;
00047 # endif
00048 #endif
00049 
00050 // Macros to create runtime deprecation warning messages in function
00051 // bodies.  Example usage:
00052 //
00053 //   #if !defined(GDCM_LEGACY_REMOVE)
00054 //   void gdcm::MyClass::MyOldMethod()
00055 //   {
00056 //     GDCM_LEGACY_BODY(gdcm::MyClass::MyOldMethod, "GDCM 2.0");
00057 //   }
00058 //   #endif
00059 //
00060 //   #if !defined(GDCM_LEGACY_REMOVE)
00061 //   void gdcm::MyClass::MyMethod()
00062 //   {
00063 //     GDCM_LEGACY_REPLACED_BODY(gdcm::MyClass::MyMethod, "GDCM 2.0",
00064 //                               gdcm::MyClass::MyOtherMethod);
00065 //   }
00066 //   #endif
00067 #if defined(GDCM_LEGACY_REMOVE) || defined(GDCM_LEGACY_SILENT)
00068 # define GDCM_LEGACY_BODY(method, version)
00069 # define GDCM_LEGACY_REPLACED_BODY(method, version, replace)
00070 #else
00071 # define GDCM_LEGACY_BODY(method, version) \
00072   gdcmWarningMacro(#method " was deprecated for " version " and will be removed in a future version.")
00073 # define GDCM_LEGACY_REPLACED_BODY(method, version, replace) \
00074   gdcmWarningMacro(#method " was deprecated for " version " and will be removed in a future version.  Use " #replace " instead.")
00075 #endif
00076 
00077 
00078 #endif // GDCMLEGACYMACRO_H

Generated on Sat Dec 4 2010 08:58:44 for GDCM by doxygen 1.7.2
SourceForge.net Logo