File indexing completed on 2025-02-22 10:26:15
0001
0002
0003
0004
0005
0006
0007 #ifndef boost_python_numpy_numpy_object_mgr_traits_hpp_
0008 #define boost_python_numpy_numpy_object_mgr_traits_hpp_
0009
0010 #include <boost/python/numpy/config.hpp>
0011
0012
0013
0014
0015
0016
0017 #define NUMPY_OBJECT_MANAGER_TRAITS(manager) \
0018 template <> \
0019 struct BOOST_NUMPY_DECL object_manager_traits<manager> \
0020 { \
0021 BOOST_STATIC_CONSTANT(bool, is_specialized = true); \
0022 static inline python::detail::new_reference adopt(PyObject* x) \
0023 { \
0024 return python::detail::new_reference(python::pytype_check((PyTypeObject*)get_pytype(), x)); \
0025 } \
0026 static bool check(PyObject* x) \
0027 { \
0028 return ::PyObject_IsInstance(x, (PyObject*)get_pytype()); \
0029 } \
0030 static manager* checked_downcast(PyObject* x) \
0031 { \
0032 return python::downcast<manager>((checked_downcast_impl)(x, (PyTypeObject*)get_pytype())); \
0033 } \
0034 static PyTypeObject const * get_pytype(); \
0035 }
0036
0037 #endif
0038