]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/python/include/boost/python/numpy/numpy_object_mgr_traits.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / python / include / boost / python / numpy / numpy_object_mgr_traits.hpp
CommitLineData
7c673cae
FG
1// Copyright Jim Bosch 2010-2012.
2// Copyright Stefan Seefeld 2016.
3// Distributed under the Boost Software License, Version 1.0.
4// (See accompanying file LICENSE_1_0.txt or copy at
5// http://www.boost.org/LICENSE_1_0.txt)
6
7#ifndef boost_python_numpy_numpy_object_mgr_traits_hpp_
8#define boost_python_numpy_numpy_object_mgr_traits_hpp_
9
10/**
11 * @brief Macro that specializes object_manager_traits by requiring a
12 * source-file implementation of get_pytype().
13 */
14
15#define NUMPY_OBJECT_MANAGER_TRAITS(manager) \
16template <> \
17struct object_manager_traits<manager> \
18{ \
19 BOOST_STATIC_CONSTANT(bool, is_specialized = true); \
20 static inline python::detail::new_reference adopt(PyObject* x) \
21 { \
22 return python::detail::new_reference(python::pytype_check((PyTypeObject*)get_pytype(), x)); \
23 } \
24 static bool check(PyObject* x) \
25 { \
26 return ::PyObject_IsInstance(x, (PyObject*)get_pytype()); \
27 } \
28 static manager* checked_downcast(PyObject* x) \
29 { \
30 return python::downcast<manager>((checked_downcast_impl)(x, (PyTypeObject*)get_pytype())); \
31 } \
32 static PyTypeObject const * get_pytype(); \
33}
34
35#endif
36