// Copyright (C) 2005 Gideon May (gideon@computer.org) // // Permission to copy, use, sell and distribute this software is granted // provided this copyright notice appears in all copies. // Permission to modify the code and to distribute modified code is granted // provided this copyright notice appears in all copies, and a notice // that the code was modified is included with the copyright notice. // // This software is provided "as is" without express or implied warranty, // and with no claim as to its suitability for any purpose. #ifndef PYOSG_PRODUCER_PTR #define PYOSG_PRODUCER_PTR 1 #include #include #include #include #include #include #include namespace Producer { template inline T * get_pointer(Producer::ref_ptr const & p) { return const_cast(p.get()); } } // namespace Producer struct make_producer_holder { typedef PyObject* result_type; template static result_type execute(T* p) { typedef Producer::ref_ptr smart_pointer; typedef boost::python::objects::pointer_holder holder_t; smart_pointer ptr(p); return boost::python::objects::make_ptr_instance::execute(ptr); } }; template struct manage_producer_object_requires_a_pointer_return_type # if defined(__GNUC__) && __GNUC__ >= 3 || defined(__EDG__) {} # endif ; struct manage_producer_object { template struct apply { typedef typename boost::mpl::if_c< boost::is_pointer::value , boost::python::to_python_indirect , manage_producer_object_requires_a_pointer_return_type >::type type; }; }; #endif // PYOSG_PRODUCER_PTR