5 #ifndef __pinocchio_python_serialization_serializable_hpp__ 6 #define __pinocchio_python_serialization_serializable_hpp__ 8 #include <boost/python.hpp> 10 #include "pinocchio/serialization/serializable.hpp" 20 template<
typename Derived>
22 :
public bp::def_visitor< SerializableVisitor<Derived> >
25 template<
class PyClass>
30 bp::arg(
"filename"),
"Saves *this inside a text file.")
32 bp::arg(
"filename"),
"Loads *this from a text file.")
36 "Parses the current object to a string.")
39 "Parses from the input string the content of the current object.")
42 bp::args(
"filename",
"tag_name"),
"Saves *this inside a XML file.")
44 bp::args(
"self",
"filename",
"tag_name"),
"Loads *this from a XML file.")
47 bp::args(
"self",
"filename"),
"Saves *this inside a binary file.")
49 bp::args(
"self",
"filename"),
"Loads *this from a binary file.")
51 .def(
"saveToBinary",(
void (Derived::*)(boost::asio::streambuf &)
const)&Derived::saveToBinary,
52 bp::args(
"self",
"buffer"),
"Saves *this inside a binary buffer.")
53 .def(
"loadFromBinary",(
void (Derived::*)(boost::asio::streambuf &))&Derived::loadFromBinary,
54 bp::args(
"self",
"buffer"),
"Loads *this from a binary buffer.")
57 bp::args(
"self",
"buffer"),
"Saves *this inside a static binary buffer.")
59 bp::args(
"self",
"buffer"),
"Loads *this from a static binary buffer.")
69 #endif // ifndef __pinocchio_python_serialization_serializable_hpp__ void visit(PyClass &cl) const
void saveToBinary(const T &object, const std::string &filename)
Saves an object inside a binary file.
void loadFromXML(T &object, const std::string &filename, const std::string &tag_name)
Loads an object from a XML file.
std::string saveToString(const T &object)
Saves an object inside a std::string.
void saveToText(const T &object, const std::string &filename)
Saves an object inside a TXT file.
Static buffer with pre-allocated memory.
void loadFromText(T &object, const std::string &filename)
Loads an object from a TXT file.
void loadFromString(T &object, const std::string &str)
Loads an object from a std::string.
Main pinocchio namespace.
void saveToXML(const T &object, const std::string &filename, const std::string &tag_name)
Saves an object inside a XML file.
void loadFromBinary(T &object, const std::string &filename)
Loads an object from a binary file.