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 
8 #include "pinocchio/serialization/archive.hpp"
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("loadFromBinary",(void (*)(T &, boost::asio::streambuf &))pinocchio::serialization::loadFromBinary<T>,
28  bp::args("object","stream_buffer"),
29  "Load an object from a binary buffer.");
30 
31  bp::def("saveToBinary",(void (*)(const T &, boost::asio::streambuf &))pinocchio::serialization::saveToBinary<T>,
32  bp::args("object","stream_buffer"),
33  "Save an object to a binary buffer.");
34 
35  bp::def("loadFromBinary",(void (*)(T &, serialization::StaticBuffer &))pinocchio::serialization::loadFromBinary<T>,
36  bp::args("object","static_buffer"),
37  "Load an object from a static binary buffer.");
38 
39  bp::def("saveToBinary",(void (*)(const T &, serialization::StaticBuffer &))pinocchio::serialization::saveToBinary<T>,
40  bp::args("object","static_buffer"),
41  "Save an object to a static binary buffer.");
42  }
43 
44  } // namespace python
45 } // namespace pinocchio
46 
47 #endif // ifndef __pinocchio_python_serialization_serialization_hpp__
Static buffer with pre-allocated memory.
boost::python::object getOrCreatePythonNamespace(const std::string &submodule_name)
Helper to create or simply return an existing namespace in Python.
Definition: namespace.hpp:22
Main pinocchio namespace.
Definition: timings.cpp:28


pinocchio
Author(s):
autogenerated on Fri Jun 23 2023 02:38:32