serialization.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2021 INRIA
3 //
4 
5 #ifndef __pinocchio_python_serialization_serialization_hpp__
6 #define __pinocchio_python_serialization_serialization_hpp__
7 
9 
12 
13 namespace pinocchio
14 {
15  namespace python
16  {
17 
18  void exposeSerialization();
19 
20  template<typename T>
21  void serialize()
22  {
23  namespace bp = boost::python;
24 
25  bp::scope current_scope = getOrCreatePythonNamespace("serialization");
26 
27  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  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  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  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  }
48 
49  } // namespace python
50 } // namespace pinocchio
51 
52 #endif // ifndef __pinocchio_python_serialization_serialization_hpp__
simulation-contact-dynamics.T
int T
Definition: simulation-contact-dynamics.py:89
archive.hpp
boost::python
pinocchio::serialization::StaticBuffer
Static buffer with pre-allocated memory.
Definition: static-buffer.hpp:16
pinocchio::python::getOrCreatePythonNamespace
boost::python::object getOrCreatePythonNamespace(const std::string &submodule_name)
Helper to create or simply return an existing namespace in Python.
Definition: namespace.hpp:34
pinocchio::python::serialize
void serialize()
Definition: serialization.hpp:21
python
fwd.hpp
pinocchio::python::exposeSerialization
void exposeSerialization()
Definition: bindings/python/serialization/serialization.cpp:43
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27
namespace.hpp


pinocchio
Author(s):
autogenerated on Thu Dec 19 2024 03:41:32