numpy_object_mgr_traits.hpp
Go to the documentation of this file.
00001 // Copyright Jim Bosch 2010-2012.
00002 // Distributed under the Boost Software License, Version 1.0.
00003 //    (See accompanying file LICENSE_1_0.txt or copy at
00004 //          http://www.boost.org/LICENSE_1_0.txt)
00005 #ifndef BOOST_NUMPY_NUMPY_OBJECT_MGR_TRAITS_HPP_INCLUDED
00006 #define BOOST_NUMPY_NUMPY_OBJECT_MGR_TRAITS_HPP_INCLUDED
00007 
00014 #define NUMPY_OBJECT_MANAGER_TRAITS(manager)                            \
00015 template <>                                                             \
00016 struct object_manager_traits<manager>                                   \
00017 {                                                                       \
00018   BOOST_STATIC_CONSTANT(bool, is_specialized = true);                   \
00019   static inline python::detail::new_reference adopt(PyObject* x)        \
00020   {                                                                     \
00021     return python::detail::new_reference(python::pytype_check((PyTypeObject*)get_pytype(), x)); \
00022   }                                                                     \
00023   static bool check(PyObject* x)                                        \
00024   {                                                                     \
00025     return ::PyObject_IsInstance(x, (PyObject*)get_pytype());           \
00026   }                                                                     \
00027   static manager* checked_downcast(PyObject* x)                         \
00028   {                                                                     \
00029     return python::downcast<manager>((checked_downcast_impl)(x, (PyTypeObject*)get_pytype())); \
00030   }                                                                     \
00031   static PyTypeObject const * get_pytype();                             \
00032 }
00033 
00034 #endif // !BOOST_NUMPY_NUMPY_OBJECT_MGR_TRAITS_HPP_INCLUDED
00035 


boost_numpy
Author(s): Jim Bosch, Ankit Daftery
autogenerated on Fri Aug 28 2015 10:10:40