source: NonGTP/Boost/boost/python/converter/registry.hpp @ 857

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