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>
20 Derived & derived() {
return *
static_cast<Derived*
>(
this); }
21 const Derived & derived()
const {
return *
static_cast<const Derived*
>(
this); }
28 pinocchio::serialization::loadFromText(derived(),filename);
34 pinocchio::serialization::saveToText(derived(),filename);
40 pinocchio::serialization::loadFromStringStream(derived(),is);
46 pinocchio::serialization::saveToStringStream(derived(),ss);
52 pinocchio::serialization::loadFromString(derived(),str);
58 return pinocchio::serialization::saveToString(derived());
63 const std::string & tag_name)
65 pinocchio::serialization::loadFromXML(derived(),filename,tag_name);
70 const std::string & tag_name)
const 72 pinocchio::serialization::saveToXML(derived(),filename,tag_name);
78 pinocchio::serialization::loadFromBinary(derived(),filename);
84 pinocchio::serialization::saveToBinary(derived(),filename);
91 #endif // ifndef __pinocchio_serialization_serializable_hpp__ void saveToBinary(const std::string &filename) const
Saves a Derived object as an binary file.
void loadFromXML(const std::string &filename, const std::string &tag_name)
Loads a Derived object from an XML file.
void loadFromString(const std::string &str)
Loads a Derived object from a string.
void loadFromBinary(const std::string &filename)
Loads a Derived object from an binary file.
std::string saveToString() const
Saves a Derived object to a string.
void loadFromStringStream(std::istringstream &is)
Loads a Derived object from a stream string.
void saveToXML(const std::string &filename, const std::string &tag_name) const
Saves a Derived object as an XML file.
void saveToText(const std::string &filename) const
Saves a Derived object as a text file.
Main pinocchio namespace.
void saveToStringStream(std::stringstream &ss) const
Saves a Derived object to a string stream.
void loadFromText(const std::string &filename)
Loads a Derived object from a text file.