From de57613c7ee1164e70629ddbe9eaa6329ae4c9d2 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Thu, 24 May 2001 20:28:34 +0000 Subject: [PATCH] gen_extension_class.py script updated. [SVN r10223] --- include/boost/python/cross_module.hpp | 4 ++-- .../boost/python/detail/extension_class.hpp | 6 +++--- src/gen_extclass.py | 18 ++++++------------ 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/include/boost/python/cross_module.hpp b/include/boost/python/cross_module.hpp index 0e5e55fa..be0320f5 100644 --- a/include/boost/python/cross_module.hpp +++ b/include/boost/python/cross_module.hpp @@ -66,7 +66,7 @@ class python_import_extension_class_converters return python_import_extension_class_converters(); } - PyObject* member_to_python(const T& x) const { + PyObject* m_to_python(const T& x) const { return boost::python::detail::import_extension_class::get_converters()->dispatcher_to_python(x); } @@ -223,7 +223,7 @@ template struct export_converter_object : export_converter_object_noncopyable { virtual PyObject* dispatcher_to_python(const T& x) { - return py_extension_class_converters(type()).member_to_python(x); + return py_extension_class_converters(type()).m_to_python(x); } }; diff --git a/include/boost/python/detail/extension_class.hpp b/include/boost/python/detail/extension_class.hpp index 34790f1f..6471a587 100644 --- a/include/boost/python/detail/extension_class.hpp +++ b/include/boost/python/detail/extension_class.hpp @@ -1,4 +1,4 @@ -// (C) Copyright David Abrahams 2000. Permission to copy, use, modify, sell and +// (C) Copyright David Abrahams 2000-2001. Permission to copy, use, modify, sell and // distribute this software is granted provided this copyright notice appears // in all copies. This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. @@ -205,7 +205,7 @@ class python_extension_class_converters /// defined below this class. Since template functions are instantiated only /// on demand, errors will be avoided unless T is noncopyable and the user /// writes code which causes us to try to copy a T. - PyObject* member_to_python(const T& x) const + PyObject* m_to_python(const T& x) const { boost::python::reference result(create_instance()); result->add_implementation( @@ -364,7 +364,7 @@ class python_extension_class_converters template PyObject* to_python(boost::python::semantics, const T& x) { - return py_extension_class_converters(boost::python::type()).member_to_python(x); + return py_extension_class_converters(boost::python::type()).m_to_python(x); } BOOST_PYTHON_END_CONVERSION_NAMESPACE diff --git a/src/gen_extclass.py b/src/gen_extclass.py index d829b9ef..7434cba4 100644 --- a/src/gen_extclass.py +++ b/src/gen_extclass.py @@ -15,6 +15,7 @@ def gen_extclass(args): // gen_extclass.python // Revision History: +// 17 Apr 01 Comment added with reference to cross_module.hpp (R.W. Grosse-Kunstleve) // 05 Mar 01 Fixed a bug which prevented auto_ptr values from being converted // to_python (Dave Abrahams) @@ -199,7 +200,7 @@ class python_extension_class_converters } /// This is a member function because in a conforming implementation, friend - /// funcitons defined inline in the class body are all instantiated as soon + /// functions defined inline in the class body are all instantiated as soon /// as the enclosing class is instantiated. If T is not copyable, that causes /// a compiler error. Instead, we access this function through the global /// template @@ -209,7 +210,7 @@ class python_extension_class_converters /// defined below this class. Since template functions are instantiated only /// on demand, errors will be avoided unless T is noncopyable and the user /// writes code which causes us to try to copy a T. - PyObject* to_python(const T& x) const + PyObject* m_to_python(const T& x) const { boost::python::reference result(create_instance()); result->add_implementation( @@ -244,13 +245,8 @@ class python_extension_class_converters /// Convert obj to T*. If obj == None, returns 0. friend T* from_python(PyObject* obj, boost::python::type) { - // forward declaration needed for ordinary lookup. - T* non_null_from_python(PyObject*, boost::python::type); - - if (obj == Py_None) - return 0; - else - return non_null_from_python(obj, boost::python::type()); + if (obj == Py_None) return 0; + return non_null_from_python(obj, boost::python::type()); } /// Extract from obj a mutable reference to the PtrType object which is holding a T. @@ -373,15 +369,13 @@ class python_extension_class_converters template PyObject* to_python(boost::python::semantics, const T& x) { - return py_extension_class_converters(boost::python::type()).to_python(x); + return py_extension_class_converters(boost::python::type()).m_to_python(x); } BOOST_PYTHON_END_CONVERSION_NAMESPACE namespace boost { namespace python { -BOOST_PYTHON_IMPORT_CONVERSION(python_extension_class_converters); - namespace detail { template class instance_holder;