5 #ifndef __pinocchio_serialization_serializable_hpp__
6 #define __pinocchio_serialization_serializable_hpp__
8 #include "pinocchio/serialization/archive.hpp"
12 namespace serialization
15 template<
class Derived>
21 return *
static_cast<Derived *
>(
this);
23 const Derived & derived()
const
25 return *
static_cast<const Derived *
>(
this);
32 pinocchio::serialization::loadFromText(derived(), filename);
38 pinocchio::serialization::saveToText(derived(), filename);
44 pinocchio::serialization::loadFromStringStream(derived(), is);
50 pinocchio::serialization::saveToStringStream(derived(), ss);
56 pinocchio::serialization::loadFromString(derived(), str);
62 return pinocchio::serialization::saveToString(derived());
66 void loadFromXML(
const std::string & filename,
const std::string & tag_name)
68 pinocchio::serialization::loadFromXML(derived(), filename, tag_name);
72 void saveToXML(
const std::string & filename,
const std::string & tag_name)
const
74 pinocchio::serialization::saveToXML(derived(), filename, tag_name);
80 pinocchio::serialization::loadFromBinary(derived(), filename);
86 pinocchio::serialization::saveToBinary(derived(), filename);
92 pinocchio::serialization::loadFromBinary(derived(), container);
98 pinocchio::serialization::saveToBinary(derived(), container);
104 pinocchio::serialization::loadFromBinary(derived(), container);
110 pinocchio::serialization::saveToBinary(derived(), container);
Main pinocchio namespace.
void saveToXML(const std::string &filename, const std::string &tag_name) const
Saves a Derived object as an XML file.
void loadFromXML(const std::string &filename, const std::string &tag_name)
Loads a Derived object from an XML file.
void saveToStringStream(std::stringstream &ss) const
Saves a Derived object to a string stream.
void loadFromBinary(const std::string &filename)
Loads a Derived object from an binary file.
void loadFromText(const std::string &filename)
Loads a Derived object from a text file.
void loadFromBinary(boost::asio::streambuf &container)
Loads a Derived object from a binary container.
void saveToBinary(boost::asio::streambuf &container) const
Saves a Derived object as a binary container.
void saveToBinary(StaticBuffer &container) const
Saves a Derived object as a static binary container.
std::string saveToString() const
Saves a Derived object to a string.
void loadFromBinary(StaticBuffer &container)
Loads a Derived object from a static binary container.
void loadFromStringStream(std::istringstream &is)
Loads a Derived object from a stream string.
void loadFromString(const std::string &str)
Loads a Derived object from a string.
void saveToText(const std::string &filename) const
Saves a Derived object as a text file.
void saveToBinary(const std::string &filename) const
Saves a Derived object as an binary file.
Static buffer with pre-allocated memory.