Chris@16
|
1 // Copyright David Abrahams 2001.
|
Chris@16
|
2 // Distributed under the Boost Software License, Version 1.0. (See
|
Chris@16
|
3 // accompanying file LICENSE_1_0.txt or copy at
|
Chris@16
|
4 // http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
5 #ifndef REGISTRY_DWA20011127_HPP
|
Chris@16
|
6 # define REGISTRY_DWA20011127_HPP
|
Chris@16
|
7 # include <boost/python/type_id.hpp>
|
Chris@16
|
8 # include <boost/python/converter/to_python_function_type.hpp>
|
Chris@16
|
9 # include <boost/python/converter/rvalue_from_python_data.hpp>
|
Chris@16
|
10 # include <boost/python/converter/constructor_function.hpp>
|
Chris@16
|
11 # include <boost/python/converter/convertible_function.hpp>
|
Chris@16
|
12
|
Chris@16
|
13 namespace boost { namespace python { namespace converter {
|
Chris@16
|
14
|
Chris@16
|
15 struct registration;
|
Chris@16
|
16
|
Chris@16
|
17 // This namespace acts as a sort of singleton
|
Chris@16
|
18 namespace registry
|
Chris@16
|
19 {
|
Chris@16
|
20 // Get the registration corresponding to the type, creating it if necessary
|
Chris@16
|
21 BOOST_PYTHON_DECL registration const& lookup(type_info);
|
Chris@16
|
22
|
Chris@16
|
23 // Get the registration corresponding to the type, creating it if
|
Chris@16
|
24 // necessary. Use this first when the type is a shared_ptr.
|
Chris@16
|
25 BOOST_PYTHON_DECL registration const& lookup_shared_ptr(type_info);
|
Chris@16
|
26
|
Chris@16
|
27 // Return a pointer to the corresponding registration, if one exists
|
Chris@16
|
28 BOOST_PYTHON_DECL registration const* query(type_info);
|
Chris@16
|
29
|
Chris@16
|
30 BOOST_PYTHON_DECL void insert(to_python_function_t, type_info, PyTypeObject const* (*to_python_target_type)() = 0);
|
Chris@16
|
31
|
Chris@16
|
32 // Insert an lvalue from_python converter
|
Chris@16
|
33 BOOST_PYTHON_DECL void insert(convertible_function, type_info, PyTypeObject const* (*expected_pytype)() = 0);
|
Chris@16
|
34
|
Chris@16
|
35 // Insert an rvalue from_python converter
|
Chris@16
|
36 BOOST_PYTHON_DECL void insert(
|
Chris@16
|
37 convertible_function
|
Chris@16
|
38 , constructor_function
|
Chris@16
|
39 , type_info
|
Chris@16
|
40 , PyTypeObject const* (*expected_pytype)() = 0
|
Chris@16
|
41 );
|
Chris@16
|
42
|
Chris@16
|
43 // Insert an rvalue from_python converter at the tail of the
|
Chris@16
|
44 // chain. Used for implicit conversions
|
Chris@16
|
45 BOOST_PYTHON_DECL void push_back(
|
Chris@16
|
46 convertible_function
|
Chris@16
|
47 , constructor_function
|
Chris@16
|
48 , type_info
|
Chris@16
|
49 , PyTypeObject const* (*expected_pytype)() = 0
|
Chris@16
|
50 );
|
Chris@16
|
51 }
|
Chris@16
|
52
|
Chris@16
|
53 }}} // namespace boost::python::converter
|
Chris@16
|
54
|
Chris@16
|
55 #endif // REGISTRY_DWA20011127_HPP
|