os/ossrv/ossrv_pub/boost_apis/boost/python/converter/registrations.hpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/ossrv_pub/boost_apis/boost/python/converter/registrations.hpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,89 @@
     1.4 +// Copyright David Abrahams 2002.
     1.5 +// Distributed under the Boost Software License, Version 1.0. (See
     1.6 +// accompanying file LICENSE_1_0.txt or copy at
     1.7 +// http://www.boost.org/LICENSE_1_0.txt)
     1.8 +#ifndef REGISTRATIONS_DWA2002223_HPP
     1.9 +# define REGISTRATIONS_DWA2002223_HPP
    1.10 +
    1.11 +# include <boost/python/detail/prefix.hpp>
    1.12 +
    1.13 +# include <boost/python/type_id.hpp>
    1.14 +
    1.15 +# include <boost/python/converter/convertible_function.hpp>
    1.16 +# include <boost/python/converter/constructor_function.hpp>
    1.17 +# include <boost/python/converter/to_python_function_type.hpp>
    1.18 +
    1.19 +# include <boost/detail/workaround.hpp>
    1.20 +
    1.21 +namespace boost { namespace python { namespace converter { 
    1.22 +
    1.23 +struct lvalue_from_python_chain
    1.24 +{
    1.25 +    convertible_function convert;
    1.26 +    lvalue_from_python_chain* next;
    1.27 +};
    1.28 +
    1.29 +struct rvalue_from_python_chain
    1.30 +{
    1.31 +    convertible_function convertible;
    1.32 +    constructor_function construct;
    1.33 +    rvalue_from_python_chain* next;
    1.34 +};
    1.35 +
    1.36 +struct BOOST_PYTHON_DECL registration
    1.37 +{
    1.38 + public: // member functions
    1.39 +    explicit registration(type_info target, bool is_shared_ptr = false);
    1.40 +    
    1.41 +    // Convert the appropriately-typed data to Python
    1.42 +    PyObject* to_python(void const volatile*) const;
    1.43 +
    1.44 +    // Return the class object, or raise an appropriate Python
    1.45 +    // exception if no class has been registered.
    1.46 +    PyTypeObject* get_class_object() const;
    1.47 +
    1.48 + public: // data members. So sue me.
    1.49 +    const python::type_info target_type;
    1.50 +
    1.51 +    // The chain of eligible from_python converters when an lvalue is required
    1.52 +    lvalue_from_python_chain* lvalue_chain;
    1.53 +
    1.54 +    // The chain of eligible from_python converters when an rvalue is acceptable
    1.55 +    rvalue_from_python_chain* rvalue_chain;
    1.56 +    
    1.57 +    // The class object associated with this type
    1.58 +    PyTypeObject* m_class_object;
    1.59 +
    1.60 +    // The unique to_python converter for the associated C++ type.
    1.61 +    to_python_function_t m_to_python;
    1.62 +
    1.63 +    // True iff this type is a shared_ptr.  Needed for special rvalue
    1.64 +    // from_python handling.
    1.65 +    const bool is_shared_ptr;
    1.66 +
    1.67 +# if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
    1.68 + private:
    1.69 +    void operator=(registration); // This is not defined, and just keeps MWCW happy.
    1.70 +# endif 
    1.71 +};
    1.72 +
    1.73 +//
    1.74 +// implementations
    1.75 +//
    1.76 +inline registration::registration(type_info target_type, bool is_shared_ptr)
    1.77 +    : target_type(target_type)
    1.78 +      , lvalue_chain(0)
    1.79 +      , rvalue_chain(0)
    1.80 +      , m_class_object(0)
    1.81 +      , m_to_python(0)
    1.82 +      , is_shared_ptr(is_shared_ptr)
    1.83 +{}
    1.84 +
    1.85 +inline bool operator<(registration const& lhs, registration const& rhs)
    1.86 +{
    1.87 +    return lhs.target_type < rhs.target_type;
    1.88 +}
    1.89 +
    1.90 +}}} // namespace boost::python::converter
    1.91 +
    1.92 +#endif // REGISTRATIONS_DWA2002223_HPP