7 #ifndef COAL_PYTHON_SERIALIZABLE_H
8 #define COAL_PYTHON_SERIALIZABLE_H
10 #include <boost/python.hpp>
22 template <
typename Derived>
24 :
public bp::def_visitor<SerializableVisitor<Derived>> {
25 template <
class PyClass>
27 cl.def(
"saveToText", &Serializer::saveToText<Derived>, bp::arg(
"filename"),
28 "Saves *this inside a text file.")
29 .def(
"loadFromText", &Serializer::loadFromText<Derived>,
30 bp::arg(
"filename"),
"Loads *this from a text file.")
32 .def(
"saveToString", &Serializer::saveToString<Derived>,
33 bp::arg(
"self"),
"Parses the current object to a string.")
34 .def(
"loadFromString", &Serializer::loadFromString<Derived>,
36 "Parses from the input string the content of the current object.")
38 .def(
"saveToXML", &Serializer::saveToXML<Derived>,
39 bp::args(
"filename",
"tag_name"),
"Saves *this inside a XML file.")
40 .def(
"loadFromXML", &Serializer::loadFromXML<Derived>,
41 bp::args(
"self",
"filename",
"tag_name"),
42 "Loads *this from a XML file.")
44 .def(
"saveToBinary", &Serializer::saveToBinary<Derived>,
45 bp::args(
"self",
"filename"),
"Saves *this inside a binary file.")
46 .def(
"loadFromBinary", &Serializer::loadFromBinary<Derived>,
47 bp::args(
"self",
"filename"),
"Loads *this from a binary file.")
49 .def(
"saveToBuffer", &Serializer::saveToBuffer<Derived>,
50 bp::args(
"self",
"buffer"),
"Saves *this inside a binary buffer.")
51 .def(
"loadFromBuffer", &Serializer::loadFromBuffer<Derived>,
52 bp::args(
"self",
"buffer"),
"Loads *this from a binary buffer.");
58 #endif // ifndef COAL_PYTHON_SERIALIZABLE_H