Chris@16: // Copyright David Abrahams 2001. Chris@16: // Distributed under the Boost Software License, Version 1.0. (See Chris@16: // accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: #ifndef CLASS_WRAPPER_DWA20011221_HPP Chris@16: # define CLASS_WRAPPER_DWA20011221_HPP Chris@16: Chris@16: # include Chris@16: #ifndef BOOST_PYTHON_NO_PY_SIGNATURES Chris@16: # include Chris@16: #endif Chris@16: # include Chris@16: Chris@16: namespace boost { namespace python { namespace objects { Chris@16: Chris@16: // Chris@16: // These two classes adapt the static execute function of a class Chris@16: // MakeInstance execute() function returning a new PyObject* Chris@16: // reference. The first one is used for class copy constructors, and Chris@16: // the second one is used to handle smart pointers. Chris@16: // Chris@16: Chris@16: template Chris@16: struct class_cref_wrapper Chris@16: : to_python_converter ,true> Chris@16: { Chris@16: static PyObject* convert(Src const& x) Chris@16: { Chris@16: return MakeInstance::execute(boost::ref(x)); Chris@16: } Chris@16: #ifndef BOOST_PYTHON_NO_PY_SIGNATURES Chris@16: static PyTypeObject const *get_pytype() { return converter::registered_pytype_direct::get_pytype(); } Chris@16: #endif Chris@16: }; Chris@16: Chris@16: template Chris@16: struct class_value_wrapper Chris@16: : to_python_converter ,true> Chris@16: { Chris@16: static PyObject* convert(Src x) Chris@16: { Chris@16: return MakeInstance::execute(x); Chris@16: } Chris@16: #ifndef BOOST_PYTHON_NO_PY_SIGNATURES Chris@16: static PyTypeObject const *get_pytype() { return MakeInstance::get_pytype(); } Chris@16: #endif Chris@16: }; Chris@16: Chris@16: }}} // namespace boost::python::objects Chris@16: Chris@16: #endif // CLASS_WRAPPER_DWA20011221_HPP