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 
21 template <typename T>
22 inline bool check_registration() {
23  const bp::type_info info = bp::type_id<T>();
24  const bp::converter::registration* reg = bp::converter::registry::query(info);
25  if (reg == NULL)
26  return false;
27  else if ((*reg).m_to_python == NULL)
28  return false;
29 
30  return true;
31 }
32 
40 template <typename T>
42  if (eigenpy::check_registration<T>()) {
43  const bp::type_info info = bp::type_id<T>();
44  const bp::converter::registration* reg =
45  bp::converter::registry::query(info);
46  bp::handle<> class_obj(reg->get_class_object());
47  bp::scope().attr(reg->get_class_object()->tp_name) = bp::object(class_obj);
48  return true;
49  }
50 
51  return false;
52 }
53 } // namespace eigenpy
54 
55 #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 Fri Jun 2 2023 02:10:26