serialization/serializable.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2017-2021 CNRS INRIA
3 //
4 
5 #ifndef __pinocchio_serialization_serializable_hpp__
6 #define __pinocchio_serialization_serializable_hpp__
7 
9 
10 namespace pinocchio
11 {
12  namespace serialization
13  {
14 
15  template<class Derived>
16  struct Serializable
17  {
18  private:
19  Derived & derived()
20  {
21  return *static_cast<Derived *>(this);
22  }
23  const Derived & derived() const
24  {
25  return *static_cast<const Derived *>(this);
26  }
27 
28  public:
30  void loadFromText(const std::string & filename)
31  {
33  }
34 
36  void saveToText(const std::string & filename) const
37  {
39  }
40 
42  void loadFromStringStream(std::istringstream & is)
43  {
45  }
46 
48  void saveToStringStream(std::stringstream & ss) const
49  {
51  }
52 
54  void loadFromString(const std::string & str)
55  {
57  }
58 
60  std::string saveToString() const
61  {
63  }
64 
66  void loadFromXML(const std::string & filename, const std::string & tag_name)
67  {
69  }
70 
72  void saveToXML(const std::string & filename, const std::string & tag_name) const
73  {
75  }
76 
78  void loadFromBinary(const std::string & filename)
79  {
81  }
82 
84  void saveToBinary(const std::string & filename) const
85  {
87  }
88 
90  void loadFromBinary(boost::asio::streambuf & container)
91  {
93  }
94 
96  void saveToBinary(boost::asio::streambuf & container) const
97  {
99  }
100 
102  void loadFromBinary(StaticBuffer & container)
103  {
105  }
106 
108  void saveToBinary(StaticBuffer & container) const
109  {
111  }
112  };
113 
114  } // namespace serialization
115 } // namespace pinocchio
116 
117 #endif // ifndef __pinocchio_serialization_serializable_hpp__
archive.hpp
pinocchio::serialization::loadFromXML
void loadFromXML(T &object, const std::string &filename, const std::string &tag_name)
Loads an object from a XML file.
Definition: archive.hpp:174
pinocchio::serialization::Serializable::loadFromString
void loadFromString(const std::string &str)
Loads a Derived object from a string.
Definition: serialization/serializable.hpp:54
pinocchio::serialization::Serializable::saveToXML
void saveToXML(const std::string &filename, const std::string &tag_name) const
Saves a Derived object as an XML file.
Definition: serialization/serializable.hpp:72
pinocchio::serialization::Serializable::loadFromText
void loadFromText(const std::string &filename)
Loads a Derived object from a text file.
Definition: serialization/serializable.hpp:30
pinocchio::serialization::loadFromString
void loadFromString(T &object, const std::string &str)
Loads an object from a std::string.
Definition: archive.hpp:141
pinocchio::serialization::Serializable::derived
const Derived & derived() const
Definition: serialization/serializable.hpp:23
pinocchio::serialization::saveToBinary
void saveToBinary(const T &object, const std::string &filename)
Saves an object inside a binary file.
Definition: archive.hpp:254
pinocchio::serialization::Serializable::loadFromBinary
void loadFromBinary(boost::asio::streambuf &container)
Loads a Derived object from a binary container.
Definition: serialization/serializable.hpp:90
pinocchio::serialization::StaticBuffer
Static buffer with pre-allocated memory.
Definition: static-buffer.hpp:16
pinocchio::serialization::saveToString
std::string saveToString(const T &object)
Saves an object inside a std::string.
Definition: archive.hpp:157
pinocchio::serialization::saveToText
void saveToText(const T &object, const std::string &filename)
Saves an object inside a TXT file.
Definition: archive.hpp:87
pinocchio::serialization::Serializable::saveToText
void saveToText(const std::string &filename) const
Saves a Derived object as a text file.
Definition: serialization/serializable.hpp:36
filename
filename
pinocchio::serialization::loadFromStringStream
void loadFromStringStream(T &object, std::istringstream &is)
Loads an object from a std::stringstream.
Definition: archive.hpp:111
pinocchio::serialization::saveToStringStream
void saveToStringStream(const T &object, std::stringstream &ss)
Saves an object inside a std::stringstream.
Definition: archive.hpp:126
pinocchio::serialization::Serializable::loadFromStringStream
void loadFromStringStream(std::istringstream &is)
Loads a Derived object from a stream string.
Definition: serialization/serializable.hpp:42
pinocchio::serialization::saveToXML
void saveToXML(const T &object, const std::string &filename, const std::string &tag_name)
Saves an object inside a XML file.
Definition: archive.hpp:204
pinocchio::serialization::Serializable::derived
Derived & derived()
Definition: serialization/serializable.hpp:19
pinocchio::serialization::loadFromBinary
void loadFromBinary(T &object, const std::string &filename)
Loads an object from a binary file.
Definition: archive.hpp:230
pinocchio::serialization::Serializable::loadFromBinary
void loadFromBinary(const std::string &filename)
Loads a Derived object from an binary file.
Definition: serialization/serializable.hpp:78
pinocchio::serialization::Serializable::saveToBinary
void saveToBinary(const std::string &filename) const
Saves a Derived object as an binary file.
Definition: serialization/serializable.hpp:84
pinocchio::serialization::Serializable::saveToStringStream
void saveToStringStream(std::stringstream &ss) const
Saves a Derived object to a string stream.
Definition: serialization/serializable.hpp:48
serialization
Definition: serialization.py:1
pinocchio::serialization::loadFromText
void loadFromText(T &object, const std::string &filename)
Loads an object from a TXT file.
Definition: archive.hpp:61
pinocchio::serialization::Serializable::saveToBinary
void saveToBinary(StaticBuffer &container) const
Saves a Derived object as a static binary container.
Definition: serialization/serializable.hpp:108
pinocchio::serialization::Serializable::loadFromXML
void loadFromXML(const std::string &filename, const std::string &tag_name)
Loads a Derived object from an XML file.
Definition: serialization/serializable.hpp:66
str
str
pinocchio::serialization::Serializable::saveToString
std::string saveToString() const
Saves a Derived object to a string.
Definition: serialization/serializable.hpp:60
pinocchio::serialization::Serializable::loadFromBinary
void loadFromBinary(StaticBuffer &container)
Loads a Derived object from a static binary container.
Definition: serialization/serializable.hpp:102
pinocchio::serialization::Serializable
Definition: serialization/serializable.hpp:16
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27
pinocchio::serialization::Serializable::saveToBinary
void saveToBinary(boost::asio::streambuf &container) const
Saves a Derived object as a binary container.
Definition: serialization/serializable.hpp:96


pinocchio
Author(s):
autogenerated on Fri Nov 1 2024 02:41:48