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.")
38 bp::args(
"self",
"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.")
46 .def(
"saveToBinary",(
void (Derived::*)(
const std::string &)
const)&Derived::saveToBinary,
47 bp::args(
"self",
"filename"),
"Saves *this inside a binary file.")
48 .def(
"loadFromBinary",(
void (Derived::*)(
const std::string &))&Derived::loadFromBinary,
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 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.