]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/python/include/boost/python/converter/pytype_object_mgr_traits.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / python / include / boost / python / converter / pytype_object_mgr_traits.hpp
CommitLineData
7c673cae
FG
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
7
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>
13
14namespace boost { namespace python { namespace converter {
15
16// Provide a forward declaration as a convenience for clients, who all
17// need it.
18template <class T> struct object_manager_traits;
19
20// Derive specializations of object_manager_traits from this class
21// when T is an object manager for a particular Python type hierarchy.
22//
23template <PyTypeObject* pytype, class T>
24struct pytype_object_manager_traits
25 : pyobject_type<T, pytype> // provides check()
26{
27 BOOST_STATIC_CONSTANT(bool, is_specialized = true);
28 static inline python::detail::new_reference adopt(PyObject*);
29};
30
31//
32// implementations
33//
34template <PyTypeObject* pytype, class T>
35inline python::detail::new_reference pytype_object_manager_traits<pytype,T>::adopt(PyObject* x)
36{
37 return python::detail::new_reference(python::pytype_check(pytype, x));
38}
39
40}}} // namespace boost::python::converter
41
42#endif // PYTYPE_OBJECT_MANAGER_TRAITS_DWA2002716_HPP