registration.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2014-2019, CNRS
3  * Copyright 2018-2019, INRIA
4  */
5 
6 #ifndef __eigenpy_registration_hpp__
7 #define __eigenpy_registration_hpp__
8 
9 #include "eigenpy/fwd.hpp"
10 
11 namespace eigenpy
12 {
20  template<typename T>
21  inline bool check_registration()
22  {
23  namespace bp = boost::python;
24 
25  const bp::type_info info = bp::type_id<T>();
26  const bp::converter::registration* reg = bp::converter::registry::query(info);
27  if (reg == NULL) return false;
28  else if ((*reg).m_to_python == NULL) return false;
29 
30  return true;
31  }
32 
40  template<typename T>
42  {
43  namespace bp = boost::python;
44 
45  if(eigenpy::check_registration<T>())
46  {
47  const bp::type_info info = bp::type_id<T>();
48  const bp::converter::registration* reg = bp::converter::registry::query(info);
49  bp::handle<> class_obj(reg->get_class_object());
50  bp::scope().attr(reg->get_class_object()->tp_name) = bp::object(class_obj);
51  return true;
52  }
53 
54  return false;
55  }
56 }
57 
58 #endif // ifndef __eigenpy_registration_hpp__
bool check_registration()
Check at runtime the registration of the type T inside the boost python registry. ...
bool register_symbolic_link_to_registered_type()
Symlink to the current scope the already registered class T.


eigenpy
Author(s): Justin Carpentier, Nicolas Mansard
autogenerated on Sat Apr 17 2021 02:37:59