1 // This file has been generated by Py++. 2 3 // Header file registry_utils.hpp 4 // 5 // provides few convenience functions for dealing with boost:python registry 6 // 7 // Copyright (c) 2010 Roman Yakovenko 8 // 9 // Use, modification and distribution is subject to the Boost Software 10 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy 11 // at http://www.boost.org/LICENSE_1_0.txt) 12 // 13 // History 14 // ======= 15 // 2010/01/12 Roman File creation 16 // 17 18 #ifndef REGISTRY_UTILS_12_01_2010_HPP 19 #define REGISTRY_UTILS_12_01_2010_HPP 20 21 #include <boost/config.hpp> 22 #include "boost/python.hpp" 23 #include "boost/python/converter/registry.hpp" 24 25 namespace boost{ namespace python{ namespace registry{ namespace utils{ 26 27 template<class T> is_registered()28bool is_registered(){ 29 namespace bpl = boost::python; 30 bpl::handle<> class_obj( bpl::objects::registered_class_object( bpl::type_id< T >())); 31 return class_obj.get() ? true : false; 32 } 33 34 template< class T > register_alias(const char * name)35void register_alias( const char* name ){ 36 namespace bpl = boost::python; 37 bpl::handle<> class_obj( bpl::objects::registered_class_object( bpl::type_id< T >())); 38 boost::python::scope().attr( name ) = bpl::object( class_obj ); 39 } 40 41 }}}} 42 43 #endif // REGISTRY_UTILS_12_01_2010_HPP 44 45 46 47