1 // Copyright Nikolay Mladenov 2007.
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 BOOST_PYTHON_OBJECT_PYTHON_TYPE_H
6 #define BOOST_PYTHON_OBJECT_PYTHON_TYPE_H
7 
8 #include <boost/python/converter/registered.hpp>
9 
10 namespace boost {namespace python {namespace detail{
11 
12 
13 template <class T> struct python_class : PyObject
14 {
15     typedef python_class<T> this_type;
16 
17     typedef T type;
18 
converterboost::python::detail::python_class19     static void *converter (PyObject *p){
20         return p;
21     }
22 
register_boost::python::detail::python_class23     static void register_()
24     {
25         static bool first_time = true;
26 
27         if ( !first_time ) return;
28 
29         first_time = false;
30         converter::registry::insert(&converter, boost::python::type_id<this_type>(), &converter::registered_pytype_direct<T>::get_pytype);
31     }
32 };
33 
34 
35 }}} //namespace boost :: python :: detail
36 
37 #endif //BOOST_PYTHON_OBJECT_PYTHON_TYPE_H
38