deprecation.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020-2021 INRIA
3 //
4 
5 #ifndef HPP_FCL_PYTHON_UTILS_DEPRECATION_H
6 #define HPP_FCL_PYTHON_UTILS_DEPRECATION_H
7 
8 #include <Python.h>
9 #include <boost/python.hpp>
10 #include <string>
11 
12 namespace hpp {
13 namespace fcl {
14 namespace python {
15 
16 template <class Policy = boost::python::default_call_policies>
17 struct deprecated_warning_policy : Policy {
18  deprecated_warning_policy(const std::string& warning_message = "")
19  : Policy(), m_warning_message(warning_message) {}
20 
21  template <class ArgumentPackage>
22  bool precall(ArgumentPackage const& args) const {
23  PyErr_WarnEx(PyExc_DeprecationWarning, m_warning_message.c_str(), 1);
24  return static_cast<const Policy*>(this)->precall(args);
25  }
26 
27  typedef typename Policy::result_converter result_converter;
28  typedef typename Policy::argument_package argument_package;
29 
30  protected:
31  const std::string m_warning_message;
32 };
33 
34 template <class Policy = boost::python::default_call_policies>
36  deprecated_member(const std::string& warning_message =
37  "This class member has been marked as deprecated and "
38  "will be removed in a future release.")
39  : deprecated_warning_policy<Policy>(warning_message) {}
40 };
41 
42 template <class Policy = boost::python::default_call_policies>
44  deprecated_function(const std::string& warning_message =
45  "This function has been marked as deprecated and "
46  "will be removed in a future release.")
47  : deprecated_warning_policy<Policy>(warning_message) {}
48 };
49 
50 } // namespace python
51 } // namespace fcl
52 } // namespace hpp
53 
54 #endif // ifndef HPP_FCL_PYTHON_UTILS_DEPRECATION_H
hpp::fcl::python::deprecated_function
Definition: deprecation.hh:43
hpp::fcl::python::deprecated_member::deprecated_member
deprecated_member(const std::string &warning_message="This class member has been marked as deprecated and " "will be removed in a future release.")
Definition: deprecation.hh:36
hpp::fcl::python::deprecated_warning_policy
Definition: deprecation.hh:17
doxygen_xml_parser.args
args
Definition: doxygen_xml_parser.py:884
hpp::fcl::python::deprecated_warning_policy::precall
bool precall(ArgumentPackage const &args) const
Definition: deprecation.hh:22
hpp::fcl::python::deprecated_warning_policy::deprecated_warning_policy
deprecated_warning_policy(const std::string &warning_message="")
Definition: deprecation.hh:18
hpp::fcl::python::deprecated_warning_policy::m_warning_message
const std::string m_warning_message
Definition: deprecation.hh:31
python
hpp
Main namespace.
Definition: broadphase_bruteforce.h:44
hpp::fcl::python::deprecated_warning_policy::argument_package
Policy::argument_package argument_package
Definition: deprecation.hh:28
hpp::fcl::python::deprecated_warning_policy::result_converter
Policy::result_converter result_converter
Definition: deprecation.hh:27
hpp::fcl::python::deprecated_function::deprecated_function
deprecated_function(const std::string &warning_message="This function has been marked as deprecated and " "will be removed in a future release.")
Definition: deprecation.hh:44
hpp::fcl::python::deprecated_member
Definition: deprecation.hh:35


hpp-fcl
Author(s):
autogenerated on Fri Jan 26 2024 03:46:13