sl@0: // Copyright David Abrahams 2002. sl@0: // Distributed under the Boost Software License, Version 1.0. (See sl@0: // accompanying file LICENSE_1_0.txt or copy at sl@0: // http://www.boost.org/LICENSE_1_0.txt) sl@0: #ifndef REGISTRATIONS_DWA2002223_HPP sl@0: # define REGISTRATIONS_DWA2002223_HPP sl@0: sl@0: # include sl@0: sl@0: # include sl@0: sl@0: # include sl@0: # include sl@0: # include sl@0: sl@0: # include sl@0: sl@0: namespace boost { namespace python { namespace converter { sl@0: sl@0: struct lvalue_from_python_chain sl@0: { sl@0: convertible_function convert; sl@0: lvalue_from_python_chain* next; sl@0: }; sl@0: sl@0: struct rvalue_from_python_chain sl@0: { sl@0: convertible_function convertible; sl@0: constructor_function construct; sl@0: rvalue_from_python_chain* next; sl@0: }; sl@0: sl@0: struct BOOST_PYTHON_DECL registration sl@0: { sl@0: public: // member functions sl@0: explicit registration(type_info target, bool is_shared_ptr = false); sl@0: sl@0: // Convert the appropriately-typed data to Python sl@0: PyObject* to_python(void const volatile*) const; sl@0: sl@0: // Return the class object, or raise an appropriate Python sl@0: // exception if no class has been registered. sl@0: PyTypeObject* get_class_object() const; sl@0: sl@0: public: // data members. So sue me. sl@0: const python::type_info target_type; sl@0: sl@0: // The chain of eligible from_python converters when an lvalue is required sl@0: lvalue_from_python_chain* lvalue_chain; sl@0: sl@0: // The chain of eligible from_python converters when an rvalue is acceptable sl@0: rvalue_from_python_chain* rvalue_chain; sl@0: sl@0: // The class object associated with this type sl@0: PyTypeObject* m_class_object; sl@0: sl@0: // The unique to_python converter for the associated C++ type. sl@0: to_python_function_t m_to_python; sl@0: sl@0: // True iff this type is a shared_ptr. Needed for special rvalue sl@0: // from_python handling. sl@0: const bool is_shared_ptr; sl@0: sl@0: # if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) sl@0: private: sl@0: void operator=(registration); // This is not defined, and just keeps MWCW happy. sl@0: # endif sl@0: }; sl@0: sl@0: // sl@0: // implementations sl@0: // sl@0: inline registration::registration(type_info target_type, bool is_shared_ptr) sl@0: : target_type(target_type) sl@0: , lvalue_chain(0) sl@0: , rvalue_chain(0) sl@0: , m_class_object(0) sl@0: , m_to_python(0) sl@0: , is_shared_ptr(is_shared_ptr) sl@0: {} sl@0: sl@0: inline bool operator<(registration const& lhs, registration const& rhs) sl@0: { sl@0: return lhs.target_type < rhs.target_type; sl@0: } sl@0: sl@0: }}} // namespace boost::python::converter sl@0: sl@0: #endif // REGISTRATIONS_DWA2002223_HPP