// Copyright (C) 2002-2003 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_HELD_PTR #define PYOSG_HELD_PTR 1 #include #include #include #include #include #include #if 0 #include #endif #include #include #include namespace boost { namespace python { template inline T * get_pointer(osg::ref_ptr const & p) { return const_cast(p.get()); } #if 0 template inline T * get_pointer(Producer::ref_ptr const & p) { return const_cast(p.get()); } #endif }} // namespace boost:python struct make_osg_holder { typedef PyObject* result_type; template static result_type execute(T* p) { typedef osg::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_osg_object_requires_a_pointer_return_type # if defined(__GNUC__) && __GNUC__ >= 3 || defined(__EDG__) {} # endif ; struct manage_osg_object { template struct apply { typedef typename boost::mpl::if_c< boost::is_pointer::value , boost::python::to_python_indirect , manage_osg_object_requires_a_pointer_return_type >::type type; }; }; #if 0 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 template struct enum_to_int_converter { static PyObject* convert(T const& x) { return PyInt_FromLong(x); } }; template void enum_as_int() { boost::python::to_python_converter >(); boost::python::implicitly_convertible(); }; #endif // PYOSG_HELD_PTR