1 |
|
|
// |
2 |
|
|
// Copyright (c) 2019 INRIA |
3 |
|
|
// |
4 |
|
|
|
5 |
|
|
#ifndef __pinocchio_python_utils_registration_hpp__ |
6 |
|
|
#define __pinocchio_python_utils_registration_hpp__ |
7 |
|
|
|
8 |
|
|
#include <boost/python.hpp> |
9 |
|
|
#include <boost/python/scope.hpp> |
10 |
|
|
|
11 |
|
|
#include <eigenpy/registration.hpp> |
12 |
|
|
|
13 |
|
|
namespace pinocchio |
14 |
|
|
{ |
15 |
|
|
namespace python |
16 |
|
|
{ |
17 |
|
|
|
18 |
|
|
template<typename T> |
19 |
|
38 |
inline bool register_symbolic_link_to_registered_type() |
20 |
|
|
{ |
21 |
|
|
namespace bp = boost::python; |
22 |
|
38 |
if(eigenpy::check_registration<T>()) |
23 |
|
|
{ |
24 |
|
|
const bp::type_info info = bp::type_id<T>(); |
25 |
|
|
const bp::converter::registration* reg = bp::converter::registry::query(info); |
26 |
|
|
bp::handle<> class_obj(reg->get_class_object()); |
27 |
|
|
bp::scope().attr(reg->get_class_object()->tp_name) = bp::object(class_obj); |
28 |
|
|
return true; |
29 |
|
|
} |
30 |
|
|
|
31 |
|
38 |
return false; |
32 |
|
|
} |
33 |
|
|
|
34 |
|
|
} // namespace python |
35 |
|
|
} // namespace pinocchio |
36 |
|
|
|
37 |
|
|
#endif // ifndef __pinocchio_python_utils_registration_hpp__ |
38 |
|
|
|