GDCM 3.0.24
gdcmLegacyMacro.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: GDCM (Grassroots DICOM). A DICOM library
4
5 Copyright (c) 2006-2011 Mathieu Malaterre
6 All rights reserved.
7 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notice for more information.
12
13=========================================================================*/
14#ifndef GDCMLEGACYMACRO_H
15#define GDCMLEGACYMACRO_H
16
17#if !defined(GDCMTYPES_H) && !defined(SWIG)
18#error you need to include gdcmTypes.h instead
19#endif
20
21#include "gdcmException.h"
22
23//----------------------------------------------------------------------------
24// Setup legacy code policy.
25
26// Define GDCM_LEGACY macro to mark legacy methods where they are
27// declared in their class. Example usage:
28//
29// // @deprecated Replaced by MyOtherMethod() as of GDCM 2.0.
30// GDCM_LEGACY(void MyMethod());
31#if defined(GDCM_LEGACY_REMOVE)
32# define GDCM_LEGACY(method)
33#elif defined(GDCM_LEGACY_SILENT) || defined(SWIG)
34 // Provide legacy methods with no warnings.
35# define GDCM_LEGACY(method) method;
36#else
37 // Setup compile-time warnings for uses of deprecated methods if
38 // possible on this compiler.
39# if defined(__GNUC__) && !defined(__INTEL_COMPILER) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
40# define GDCM_LEGACY(method) method __attribute__((deprecated));
41# elif defined(_MSC_VER) && _MSC_VER >= 1300
42# define GDCM_LEGACY(method) __declspec(deprecated) method;
43# else
44# define GDCM_LEGACY(method) method;
45# endif
46#endif
47
57# define GDCM_NOOP_STATEMENT static_assert(true, "")
58
59// Macros to create runtime deprecation warning messages in function
60// bodies. Example usage:
61//
62// #if !defined(GDCM_LEGACY_REMOVE)
63// void gdcm::MyClass::MyOldMethod()
64// {
65// GDCM_LEGACY_BODY(gdcm::MyClass::MyOldMethod, "GDCM 2.0");
66// }
67// #endif
68//
69// #if !defined(GDCM_LEGACY_REMOVE)
70// void gdcm::MyClass::MyMethod()
71// {
72// GDCM_LEGACY_REPLACED_BODY(gdcm::MyClass::MyMethod, "GDCM 2.0",
73// gdcm::MyClass::MyOtherMethod);
74// }
75// #endif
76#if defined(GDCM_LEGACY_REMOVE) || defined(GDCM_LEGACY_SILENT)
77# define GDCM_LEGACY_BODY(method, version)
78# define GDCM_LEGACY_REPLACED_BODY(method, version, replace)
79#else
80# define GDCM_LEGACY_BODY(method, version) \
81 gdcmWarningMacro(#method " was deprecated for " version " and will be removed in a future version.")
82# define GDCM_LEGACY_REPLACED_BODY(method, version, replace) \
83 gdcmWarningMacro(#method " was deprecated for " version " and will be removed in a future version. Use " #replace " instead.")
84#endif
85
86#include "gdcmTrace.h"
87
88#endif // GDCMLEGACYMACRO_H