Directory: | ./ |
---|---|
File: | include/pinocchio/bindings/python/serialization/serialization.hpp |
Date: | 2024-08-27 18:20:05 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 7 | 7 | 100.0% |
Branches: | 11 | 22 | 50.0% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | // | ||
2 | // Copyright (c) 2021 INRIA | ||
3 | // | ||
4 | |||
5 | #ifndef __pinocchio_python_serialization_serialization_hpp__ | ||
6 | #define __pinocchio_python_serialization_serialization_hpp__ | ||
7 | |||
8 | #include "pinocchio/serialization/archive.hpp" | ||
9 | |||
10 | #include "pinocchio/bindings/python/fwd.hpp" | ||
11 | #include "pinocchio/bindings/python/utils/namespace.hpp" | ||
12 | |||
13 | namespace pinocchio | ||
14 | { | ||
15 | namespace python | ||
16 | { | ||
17 | |||
18 | void exposeSerialization(); | ||
19 | |||
20 | template<typename T> | ||
21 | 1200 | void serialize() | |
22 | { | ||
23 | namespace bp = boost::python; | ||
24 | |||
25 |
3/6✓ Branch 2 taken 660 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 660 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 660 times.
✗ Branch 9 not taken.
|
2400 | bp::scope current_scope = getOrCreatePythonNamespace("serialization"); |
26 | |||
27 |
2/4✓ Branch 1 taken 660 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 660 times.
✗ Branch 5 not taken.
|
1200 | bp::def( |
28 | "loadFromBinary", | ||
29 | (void (*)(T &, boost::asio::streambuf &))pinocchio::serialization::loadFromBinary<T>, | ||
30 | bp::args("object", "stream_buffer"), "Load an object from a binary buffer."); | ||
31 | |||
32 |
2/4✓ Branch 1 taken 660 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 660 times.
✗ Branch 5 not taken.
|
1200 | bp::def( |
33 | "saveToBinary", | ||
34 | (void (*)(const T &, boost::asio::streambuf &))pinocchio::serialization::saveToBinary<T>, | ||
35 | bp::args("object", "stream_buffer"), "Save an object to a binary buffer."); | ||
36 | |||
37 |
2/4✓ Branch 1 taken 660 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 660 times.
✗ Branch 5 not taken.
|
1200 | bp::def( |
38 | "loadFromBinary", | ||
39 | (void (*)(T &, serialization::StaticBuffer &))pinocchio::serialization::loadFromBinary<T>, | ||
40 | bp::args("object", "static_buffer"), "Load an object from a static binary buffer."); | ||
41 | |||
42 |
2/4✓ Branch 1 taken 660 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 660 times.
✗ Branch 5 not taken.
|
1200 | bp::def( |
43 | "saveToBinary", | ||
44 | (void (*)( | ||
45 | const T &, serialization::StaticBuffer &))pinocchio::serialization::saveToBinary<T>, | ||
46 | bp::args("object", "static_buffer"), "Save an object to a static binary buffer."); | ||
47 | 1200 | } | |
48 | |||
49 | } // namespace python | ||
50 | } // namespace pinocchio | ||
51 | |||
52 | #endif // ifndef __pinocchio_python_serialization_serialization_hpp__ | ||
53 |