Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/python/return_opaque_pointer.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Copyright Gottfried Ganßauge 2003.
0002 // Distributed under the Boost Software License, Version 1.0. (See
0003 // accompanying file LICENSE_1_0.txt or copy at
0004 // http://www.boost.org/LICENSE_1_0.txt)
0005 /*
0006  * Generic Return value converter generator for opaque C++-pointers
0007  */
0008 # ifndef RETURN_OPAQUE_POINTER_HPP_
0009 # define RETURN_OPAQUE_POINTER_HPP_
0010 
0011 # include <boost/python/detail/prefix.hpp>
0012 # include <boost/python/opaque_pointer_converter.hpp>
0013 # include <boost/python/detail/force_instantiate.hpp>
0014 # include <boost/python/to_python_value.hpp>
0015 # include <boost/python/detail/value_arg.hpp>
0016 # include <boost/mpl/assert.hpp>
0017 
0018 namespace boost { namespace python {
0019 
0020 namespace detail
0021 {
0022   template <class Pointee>
0023   static void opaque_pointee(Pointee const volatile*)
0024   {
0025       force_instantiate(opaque<Pointee>::instance);
0026   }
0027 }
0028 
0029 struct return_opaque_pointer
0030 {
0031     template <class R>
0032     struct apply
0033     {
0034         BOOST_MPL_ASSERT_MSG( is_pointer<R>::value, RETURN_OPAQUE_POINTER_EXPECTS_A_POINTER_TYPE, (R));
0035         
0036         struct type :  
0037           boost::python::to_python_value<
0038               typename detail::value_arg<R>::type
0039           >
0040         {
0041             type() { detail::opaque_pointee(R()); }
0042         };
0043     };
0044 };
0045 
0046 }} // namespace boost::python
0047 # endif // RETURN_OPAQUE_POINTER_HPP_