GDCM 2.2.0

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Directories
- Examples

- File List
- File Members

gdcmLegacyMacro.h
Go to the documentation of this file.

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