Mercurial > hg > vamp-build-and-test
annotate DEPENDENCIES/generic/include/boost/python/converter/shared_ptr_to_python.hpp @ 133:4acb5d8d80b6 tip
Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author | Chris Cannam |
---|---|
date | Tue, 30 Jul 2019 12:25:44 +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 |