src/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 
8 #include "pinocchio/serialization/archive.hpp"
9 
10 namespace pinocchio
11 {
12  namespace serialization
13  {
14 
15  template<class Derived>
16  struct Serializable
17  {
18  private:
19 
20  Derived & derived() { return *static_cast<Derived*>(this); }
21  const Derived & derived() const { return *static_cast<const Derived*>(this); }
22 
23  public:
24 
26  void loadFromText(const std::string & filename)
27  {
29  }
30 
32  void saveToText(const std::string & filename) const
33  {
35  }
36 
38  void loadFromStringStream(std::istringstream & is)
39  {
41  }
42 
44  void saveToStringStream(std::stringstream & ss) const
45  {
47  }
48 
50  void loadFromString(const std::string & str)
51  {
53  }
54 
56  std::string saveToString() const
57  {
59  }
60 
62  void loadFromXML(const std::string & filename,
63  const std::string & tag_name)
64  {
66  }
67 
69  void saveToXML(const std::string & filename,
70  const std::string & tag_name) const
71  {
72  pinocchio::serialization::saveToXML(derived(),filename,tag_name);
73  }
74 
76  void loadFromBinary(const std::string & filename)
77  {
79  }
80 
82  void saveToBinary(const std::string & filename) const
83  {
85  }
86 
88  void loadFromBinary(boost::asio::streambuf & container)
89  {
91  }
92 
94  void saveToBinary(boost::asio::streambuf & container) const
95  {
97  }
98 
100  void loadFromBinary(StaticBuffer & container)
101  {
103  }
104 
106  void saveToBinary(StaticBuffer & container) const
107  {
109  }
110 
111  };
112 
113  }
114 } // namespace pinocchio
115 
116 #endif // ifndef __pinocchio_serialization_serializable_hpp__
117 
void saveToBinary(const T &object, const std::string &filename)
Saves an object inside a binary file.
Definition: archive.hpp:263
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.
void loadFromXML(const std::string &filename, const std::string &tag_name)
Loads a Derived object from an XML file.
void loadFromXML(T &object, const std::string &filename, const std::string &tag_name)
Loads an object from a XML file.
Definition: archive.hpp:179
void loadFromBinary(StaticBuffer &container)
Loads a Derived object from a static binary container.
void saveToStringStream(const T &object, std::stringstream &ss)
Saves an object inside a std::stringstream.
Definition: archive.hpp:129
void loadFromBinary(boost::asio::streambuf &container)
Loads a Derived object from a binary container.
std::string saveToString(const T &object)
Saves an object inside a std::string.
Definition: archive.hpp:162
void saveToText(const T &object, const std::string &filename)
Saves an object inside a TXT file.
Definition: archive.hpp:88
void saveToStringStream(std::stringstream &ss) const
Saves a Derived object to a string stream.
std::string saveToString() const
Saves a Derived object to a string.
Static buffer with pre-allocated memory.
void saveToXML(const std::string &filename, const std::string &tag_name) const
Saves a Derived object as an XML file.
void loadFromText(T &object, const std::string &filename)
Loads an object from a TXT file.
Definition: archive.hpp:61
void saveToBinary(const std::string &filename) const
Saves a Derived object as an binary file.
void loadFromStringStream(std::istringstream &is)
Loads a Derived object from a stream string.
void loadFromString(T &object, const std::string &str)
Loads an object from a std::string.
Definition: archive.hpp:145
void loadFromStringStream(T &object, std::istringstream &is)
Loads an object from a std::stringstream.
Definition: archive.hpp:113
Main pinocchio namespace.
Definition: timings.cpp:28
void saveToXML(const T &object, const std::string &filename, const std::string &tag_name)
Saves an object inside a XML file.
Definition: archive.hpp:210
void loadFromString(const std::string &str)
Loads a Derived object from a string.
void loadFromText(const std::string &filename)
Loads a Derived object from a text file.
void saveToText(const std::string &filename) const
Saves a Derived object as a text file.
void loadFromBinary(T &object, const std::string &filename)
Loads an object from a binary file.
Definition: archive.hpp:238
void loadFromBinary(const std::string &filename)
Loads a Derived object from an binary file.


pinocchio
Author(s):
autogenerated on Fri Jun 23 2023 02:38:32