1 // Copyright David Abrahams 2002.
2 // Distributed under the Boost Software License, Version 1.0. (See
3 // accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5 #ifndef PYTYPE_OBJECT_MANAGER_TRAITS_DWA2002716_HPP
6 # define PYTYPE_OBJECT_MANAGER_TRAITS_DWA2002716_HPP
8 # include <boost/python/detail/prefix.hpp>
9 # include <boost/python/detail/raw_pyobject.hpp>
10 # include <boost/python/cast.hpp>
11 # include <boost/python/converter/pyobject_type.hpp>
12 # include <boost/python/errors.hpp>
14 namespace boost { namespace python { namespace converter {
16 // Provide a forward declaration as a convenience for clients, who all
18 template <class T> struct object_manager_traits;
20 // Derive specializations of object_manager_traits from this class
21 // when T is an object manager for a particular Python type hierarchy.
23 template <PyTypeObject* pytype, class T>
24 struct pytype_object_manager_traits
25 : pyobject_type<T, pytype> // provides check()
27 BOOST_STATIC_CONSTANT(bool, is_specialized = true);
28 static inline python::detail::new_reference adopt(PyObject*);
34 template <PyTypeObject* pytype, class T>
35 inline python::detail::new_reference pytype_object_manager_traits<pytype,T>::adopt(PyObject* x)
37 return python::detail::new_reference(python::pytype_check(pytype, x));
40 }}} // namespace boost::python::converter
42 #endif // PYTYPE_OBJECT_MANAGER_TRAITS_DWA2002716_HPP