00001 /** 00002 * \file deprecation.h 00003 * \brief Control display of deprecation information. 00004 * 00005 * Copyright 2007-2010 IMP Inventors. All rights reserved. 00006 * 00007 */ 00008 00009 #ifndef IMP_DEPRECATION_H 00010 #define IMP_DEPRECATION_H 00011 00012 #include "kernel_config.h" 00013 #include "internal/deprecation.h" 00014 00015 IMP_BEGIN_NAMESPACE 00016 00017 //! Toggle printing of warnings on using deprecated classes 00018 /** If set to true (the default) a warning is printed every 00019 time a class marked as deprecated is used. 00020 \sa IMP_DEPRECATED 00021 */ 00022 IMPEXPORT void set_print_deprecation_messages(bool tf); 00023 00024 IMP_END_NAMESPACE 00025 00026 /** \brief Mark the class as deprecated. It will print out a message. 00027 00028 From time to time, \imp is updated in ways that break backward 00029 compatibility. In certain cases we will leave the old functionality 00030 in so as not to break existing code which uses \imp. Such code is 00031 said to be "deprecated". See \salilab{imp/doc/doxygen/deprecated.html, 00032 the deprecated class list} for a list of such classes. 00033 00034 Deprecated classes are marked in a variety of ways: 00035 - They are listed in the "Deprecated List" in the "Related Pages" tab. 00036 - They are noted as deprecated in their documentation. 00037 - They print a warning when an instance is constructed or the function 00038 is called. 00039 00040 The warnings can be turned off using the 00041 IMP::core::set_print_deprecation_messages function. 00042 \param[in] old_classname The class which is deprecated. 00043 \param[in] replacement_classname The class which replaces it. 00044 00045 Further, \imp can be built without deprecated code by defining 00046 \c IMP_NO_DEPRECATED or the \c deprecated=False \c scons argument. 00047 00048 You should also use the \deprecated command in the doxygen documentation. 00049 */ 00050 #define IMP_DEPRECATED(old_classname, replacement_classname) \ 00051 if (::IMP::internal::get_print_deprecation_message(#old_classname)) { \ 00052 IMP_LOG(WARNING, "WARNING: Class " << #old_classname \ 00053 << " is deprecated " \ 00054 << "and should not be used.\nUse the class " \ 00055 << #replacement_classname << " instead." << std::endl); \ 00056 ::IMP::internal::set_printed_deprecation_message(#old_classname, \ 00057 true); \ 00058 } 00059 00060 #ifdef __GNU__ 00061 #define IMP_DEPRECATED_WARN __attribute__ ((deprecated)) 00062 #else 00063 #define IMP_DEPRECATED_WARN 00064 #endif 00065 00066 #endif /* IMP_DEPRECATION_H */