Directory: | ./ |
---|---|
File: | include/pinocchio/bindings/python/utils/registration.hpp |
Date: | 2025-02-12 21:03:38 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 9 | 9 | 100.0% |
Branches: | 10 | 18 | 55.6% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | // | ||
2 | // Copyright (c) 2019-2020 INRIA | ||
3 | // | ||
4 | |||
5 | #ifndef __pinocchio_python_utils_registration_hpp__ | ||
6 | #define __pinocchio_python_utils_registration_hpp__ | ||
7 | |||
8 | #include <eigenpy/registration.hpp> | ||
9 | |||
10 | namespace pinocchio | ||
11 | { | ||
12 | namespace python | ||
13 | { | ||
14 | |||
15 | template<typename T> | ||
16 | 1129 | inline bool register_symbolic_link_to_registered_type() | |
17 | { | ||
18 | namespace bp = boost::python; | ||
19 |
2/2✓ Branch 1 taken 8 times.
✓ Branch 2 taken 195 times.
|
1129 | if (eigenpy::check_registration<T>()) |
20 | { | ||
21 | 154 | const bp::type_info info = bp::type_id<T>(); | |
22 |
1/2✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
|
154 | const bp::converter::registration * reg = bp::converter::registry::query(info); |
23 |
2/4✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 8 times.
✗ Branch 6 not taken.
|
154 | bp::handle<> class_obj(bp::borrowed(reg->get_class_object())); |
24 |
5/10✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 8 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 8 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 8 times.
✗ Branch 14 not taken.
|
154 | bp::scope().attr(reg->get_class_object()->tp_name) = bp::object(class_obj); |
25 | 154 | return true; | |
26 | 154 | } | |
27 | |||
28 | 975 | return false; | |
29 | } | ||
30 | |||
31 | } // namespace python | ||
32 | } // namespace pinocchio | ||
33 | |||
34 | #endif // ifndef __pinocchio_python_utils_registration_hpp__ | ||
35 |