annotate DEPENDENCIES/generic/include/boost/python/converter/shared_ptr_to_python.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // Copyright David Abrahams 2003.
Chris@16 2 // Distributed under the Boost Software License, Version 1.0. (See
Chris@16 3 // accompanying file LICENSE_1_0.txt or copy at
Chris@16 4 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 5 #ifndef SHARED_PTR_TO_PYTHON_DWA2003224_HPP
Chris@16 6 # define SHARED_PTR_TO_PYTHON_DWA2003224_HPP
Chris@16 7
Chris@16 8 # include <boost/python/refcount.hpp>
Chris@16 9 # include <boost/python/converter/shared_ptr_deleter.hpp>
Chris@16 10 # include <boost/shared_ptr.hpp>
Chris@16 11 # include <boost/get_pointer.hpp>
Chris@16 12
Chris@16 13 namespace boost { namespace python { namespace converter {
Chris@16 14
Chris@16 15 template <class T>
Chris@16 16 PyObject* shared_ptr_to_python(shared_ptr<T> const& x)
Chris@16 17 {
Chris@16 18 if (!x)
Chris@16 19 return python::detail::none();
Chris@16 20 else if (shared_ptr_deleter* d = boost::get_deleter<shared_ptr_deleter>(x))
Chris@16 21 return incref( get_pointer( d->owner ) );
Chris@16 22 else
Chris@16 23 return converter::registered<shared_ptr<T> const&>::converters.to_python(&x);
Chris@16 24 }
Chris@16 25
Chris@16 26 }}} // namespace boost::python::converter
Chris@16 27
Chris@16 28 #endif // SHARED_PTR_TO_PYTHON_DWA2003224_HPP