# gdcmMacro.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-2009 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 __gdcmMacro_h
    00016 #define __gdcmMacro_h
    00017
    00018 #include "gdcmException.h"
    00019 #include "gdcmTrace.h"
    00020
    00021 //----------------------------------------------------------------------------
    00022 // Setup legacy code policy.
    00023
    00024 // Define GDCM_LEGACY macro to mark legacy methods where they are
    00025 // declared in their class.  Example usage:
    00026 //
    00027 //   // @deprecated Replaced by MyOtherMethod() as of GDCM 2.0.
    00028 //   GDCM_LEGACY(void MyMethod());
    00029 #if defined(GDCM_LEGACY_REMOVE)
    00030 # define GDCM_LEGACY(method)
    00031 #elif defined(GDCM_LEGACY_SILENT) || defined(SWIG)
    00032   // Provide legacy methods with no warnings.
    00033 # define GDCM_LEGACY(method) method;
    00034 #else
    00035   // Setup compile-time warnings for uses of deprecated methods if
    00036   // possible on this compiler.
    00037 # if defined(__GNUC__) && !defined(__INTEL_COMPILER) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
    00038 #  define GDCM_LEGACY(method) method __attribute__((deprecated));
    00039 # elif defined(_MSC_VER) && _MSC_VER >= 1300
    00040 #  define GDCM_LEGACY(method) __declspec(deprecated) method;
    00041 # else
    00042 #  define GDCM_LEGACY(method) method;
    00043 # endif
    00044 #endif
    00045
    00046 // Macros to create runtime deprecation warning messages in function
    00047 // bodies.  Example usage:
    00048 //
    00049 //   #if !defined(GDCM_LEGACY_REMOVE)
    00050 //   void gdcm::MyClass::MyOldMethod()
    00051 //   {
    00052 //     GDCM_LEGACY_BODY(gdcm::MyClass::MyOldMethod, "GDCM 2.0");
    00053 //   }
    00054 //   #endif
    00055 //
    00056 //   #if !defined(GDCM_LEGACY_REMOVE)
    00057 //   void gdcm::MyClass::MyMethod()
    00058 //   {
    00059 //     GDCM_LEGACY_REPLACED_BODY(gdcm::MyClass::MyMethod, "GDCM 2.0",
    00060 //                               gdcm::MyClass::MyOtherMethod);
    00061 //   }
    00062 //   #endif
    00063 #if defined(GDCM_LEGACY_REMOVE) || defined(GDCM_LEGACY_SILENT)
    00064 # define GDCM_LEGACY_BODY(method, version)
    00065 # define GDCM_LEGACY_REPLACED_BODY(method, version, replace)
    00066 #else
    00067 # define GDCM_LEGACY_BODY(method, version) \
    00068   gdcmWarningMacro(#method " was deprecated for " version " and will be removed in a future version.")
    00069 # define GDCM_LEGACY_REPLACED_BODY(method, version, replace) \
    00070   gdcmWarningMacro(#method " was deprecated for " version " and will be removed in a future version.  Use " #replace " instead.")
    00071 #endif
    00072
    00073
    00074 #endif // __gdcmMacro_h