GDCM 2.2.1

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

- File List
- File Members

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
48 // Macros to create runtime deprecation warning messages in function
49 // bodies. Example usage:
50 //
51 // #if !defined(GDCM_LEGACY_REMOVE)
52 // void gdcm::MyClass::MyOldMethod()
53 // {
54 // GDCM_LEGACY_BODY(gdcm::MyClass::MyOldMethod, "GDCM 2.0");
55 // }
56 // #endif
57 //
58 // #if !defined(GDCM_LEGACY_REMOVE)
59 // void gdcm::MyClass::MyMethod()
60 // {
61 // GDCM_LEGACY_REPLACED_BODY(gdcm::MyClass::MyMethod, "GDCM 2.0",
62 // gdcm::MyClass::MyOtherMethod);
63 // }
64 // #endif
65 #if defined(GDCM_LEGACY_REMOVE) || defined(GDCM_LEGACY_SILENT)
66 # define GDCM_LEGACY_BODY(method, version)
67 # define GDCM_LEGACY_REPLACED_BODY(method, version, replace)
68 #else
69 # define GDCM_LEGACY_BODY(method, version) \
70 gdcmWarningMacro(#method " was deprecated for " version " and will be removed in a future version.")
71 # define GDCM_LEGACY_REPLACED_BODY(method, version, replace) \
72 gdcmWarningMacro(#method " was deprecated for " version " and will be removed in a future version. Use " #replace " instead.")
73 #endif
74
75 #include "gdcmTrace.h"
76
77 #endif // GDCMLEGACYMACRO_H