1 /*=========================================================================
4 Module: $RCSfile: gdcmMacro.h,v $
6 Date: $Date: 2005/11/28 15:20:34 $
7 Version: $Revision: 1.3 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/Gdcm/License.html for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
22 //-----------------------------------------------------------------------------
23 #define gdcmTypeMacro(type) \
25 type(type &); /* Not implemented */ \
26 type &operator=(type &) /* Not implemented */
28 #define gdcmNewMacro(type) \
30 static type *New() {return new type(); } /* Not implemented */
32 //-----------------------------------------------------------------------------
34 // Define GDCM_LEGACY macro to mark legacy methods where they are
35 // declared in their class.
37 // WARNING : Don't try to use it with 'inline' methods !
41 // // @deprecated Replaced by MyOtherMethod() as of gdcm 2.0.
42 // GDCM_LEGACY(void MyMethod());
43 #if defined(GDCM_LEGACY_REMOVE)
44 // Remove legacy methods completely.
45 # define GDCM_LEGACY(method)
46 #elif defined(GDCM_LEGACY_SILENT) || defined(SWIG)
47 // Provide legacy methods with no warnings.
48 # define GDCM_LEGACY(method) method
50 // Setup compile-time warnings for uses of deprecated methods if
51 // possible on this compiler.
52 # if defined(__GNUC__) && !defined(__INTEL_COMPILER) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
53 #if defined(__APPLE__) && (__GNUC__ == 3) && (__GNUC_MINOR__ == 3)
54 // Seems like there is a bug in APPLE gcc for deprecated attribute and ctor
55 // This is fixed in g++ 4.0 (Tiger)
56 # define GDCM_LEGACY(method) method
58 # define GDCM_LEGACY(method) method __attribute__((deprecated))
60 # elif defined(_MSC_VER) && _MSC_VER >= 1300
61 # define GDCM_LEGACY(method) __declspec(deprecated) method
63 # define GDCM_LEGACY(method) method
67 // Macros to create runtime deprecation warning messages in function
68 // bodies. Example usage:
70 // void MyClass::MyOldMethod()
72 // GDCM_LEGACY_BODY(MyClass::MyOldMethod, 2.0);
75 // void MyClass::MyMethod()
77 // GDCM_LEGACY_REPLACED_BODY(MyClass::MyMethod, 5.0,
78 // MyClass::MyOtherMethod);
80 #if defined(GDCM_LEGACY_REMOVE) || defined(GDCM_LEGACY_SILENT)
81 # define GDCM_LEGACY_BODY(method, version)
82 # define GDCM_LEGACY_REPLACED_BODY(method, version, replace)
84 # define GDCM_LEGACY_BODY(method, version) \
85 gdcmWarningMacro(#method " was deprecated for gdcm" #version " and will be removed in a future version.")
86 # define GDCM_LEGACY_REPLACED_BODY(method, version, replace) \
87 gdcmWarningMacro(#method " was deprecated for gdcm" #version " and will be removed in a future version. Use " #replace " instead.")
90 //-----------------------------------------------------------------------------