28#include <boost/serialization/optional.hpp>
29#include <boost/serialization/shared_ptr.hpp>
30#include <boost/serialization/vector.hpp>
31#include <boost/serialization/map.hpp>
32#include <boost/serialization/list.hpp>
33#include <boost/serialization/deque.hpp>
34#include <boost/serialization/weak_ptr.hpp>
36#include <boost/archive/text_oarchive.hpp>
37#include <boost/archive/text_iarchive.hpp>
38#include <boost/archive/xml_iarchive.hpp>
39#include <boost/archive/xml_oarchive.hpp>
40#include <boost/archive/binary_iarchive.hpp>
41#include <boost/archive/binary_oarchive.hpp>
42#include <boost/serialization/export.hpp>
47#if __GNUC__ >= 7 && __cplusplus >= 201703L
48namespace boost {
namespace serialization {
struct U; } }
49namespace Eigen {
namespace internal {
50template<>
struct traits<boost::serialization::U> {
enum {Flags=0};};
64 boost::archive::text_oarchive out_archive(out_archive_stream);
71 boost::archive::text_iarchive in_archive(in_archive_stream);
78 std::ostringstream out_archive_stream;
80 return out_archive_stream.str();
86 std::istringstream in_archive_stream(serialized);
93 std::ofstream out_archive_stream(filename.c_str());
94 if (!out_archive_stream.is_open())
return false;
96 out_archive_stream.close();
103 std::ifstream in_archive_stream(filename.c_str());
104 if (!in_archive_stream.is_open())
return false;
106 in_archive_stream.close();
130 const std::string& name =
"data") {
131 boost::archive::xml_oarchive out_archive(out_archive_stream);
132 out_archive << boost::serialization::make_nvp(name.c_str(), input);
138 const std::string& name =
"data") {
139 boost::archive::xml_iarchive in_archive(in_archive_stream);
140 in_archive >> boost::serialization::make_nvp(name.c_str(), output);
146 const std::string& name =
"data") {
147 std::ostringstream out_archive_stream;
149 return out_archive_stream.str();
155 const std::string& name =
"data") {
156 std::istringstream in_archive_stream(serialized);
163 const std::string& name =
"data") {
164 std::ofstream out_archive_stream(filename.c_str());
165 if (!out_archive_stream.is_open())
return false;
167 out_archive_stream.close();
174 const std::string& name =
"data") {
175 std::ifstream in_archive_stream(filename.c_str());
176 if (!in_archive_stream.is_open())
return false;
178 in_archive_stream.close();
185 const std::string& name =
"data") {
192 const std::string& name =
"data") {
204 const std::string& name =
"data") {
205 boost::archive::binary_oarchive out_archive(out_archive_stream);
206 out_archive << boost::serialization::make_nvp(name.c_str(), input);
212 const std::string& name =
"data") {
213 boost::archive::binary_iarchive in_archive(in_archive_stream);
214 in_archive >> boost::serialization::make_nvp(name.c_str(), output);
220 const std::string& name =
"data") {
221 std::ostringstream out_archive_stream;
223 return out_archive_stream.str();
229 const std::string& name =
"data") {
230 std::istringstream in_archive_stream(serialized);
237 const std::string& name =
"data") {
238 std::ofstream out_archive_stream(filename.c_str());
239 if (!out_archive_stream.is_open())
return false;
241 out_archive_stream.close();
248 const std::string& name =
"data") {
249 std::ifstream in_archive_stream(filename.c_str());
250 if (!in_archive_stream.is_open())
return false;
252 in_archive_stream.close();
259 const std::string& name =
"data") {
266 const std::string& name =
"data") {
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
void serializeToStream(const T &input, std::ostream &out_archive_stream)
Definition: serialization.h:63
bool deserializeFromXMLFile(const std::string &filename, T &output, const std::string &name="data")
deserializes from an XML file
Definition: serialization.h:173
std::string serializeToXMLString(const T &input, const std::string &name="data")
serializes to a string in XML
Definition: serialization.h:145
void deserializeFromString(const std::string &serialized, T &output)
deserializes from a string
Definition: serialization.h:85
std::string serialize(const T &input)
serializes to a string
Definition: serialization.h:112
void deserializeFromBinaryString(const std::string &serialized, T &output, const std::string &name="data")
deserializes from a string in binary
Definition: serialization.h:228
void deserializeBinary(const std::string &serialized, T &output, const std::string &name="data")
deserializes from a string in binary
Definition: serialization.h:265
void deserializeFromXMLString(const std::string &serialized, T &output, const std::string &name="data")
deserializes from a string in XML
Definition: serialization.h:154
std::string serializeToBinaryString(const T &input, const std::string &name="data")
serializes to a string in binary
Definition: serialization.h:219
void deserializeXML(const std::string &serialized, T &output, const std::string &name="data")
deserializes from a string in XML
Definition: serialization.h:191
bool serializeToXMLFile(const T &input, const std::string &filename, const std::string &name="data")
serializes to an XML file
Definition: serialization.h:162
void deserializeFromXMLStream(std::istream &in_archive_stream, T &output, const std::string &name="data")
deserializes from a stream in XML
Definition: serialization.h:137
void deserializeFromBinaryStream(std::istream &in_archive_stream, T &output, const std::string &name="data")
deserializes from a stream in binary
Definition: serialization.h:211
std::string serializeXML(const T &input, const std::string &name="data")
serializes to a string in XML
Definition: serialization.h:184
std::string serializeToString(const T &input)
serializes to a string
Definition: serialization.h:77
bool serializeToFile(const T &input, const std::string &filename)
serializes to a file
Definition: serialization.h:92
void deserialize(const std::string &serialized, T &output)
deserializes from a string
Definition: serialization.h:118
void serializeToBinaryStream(const T &input, std::ostream &out_archive_stream, const std::string &name="data")
Definition: serialization.h:203
void deserializeFromStream(std::istream &in_archive_stream, T &output)
deserializes from a stream
Definition: serialization.h:70
std::string serializeBinary(const T &input, const std::string &name="data")
serializes to a string in binary
Definition: serialization.h:258
bool serializeToBinaryFile(const T &input, const std::string &filename, const std::string &name="data")
serializes to a binary file
Definition: serialization.h:236
bool deserializeFromFile(const std::string &filename, T &output)
deserializes from a file
Definition: serialization.h:102
void serializeToXMLStream(const T &input, std::ostream &out_archive_stream, const std::string &name="data")
Definition: serialization.h:129
bool deserializeFromBinaryFile(const std::string &filename, T &output, const std::string &name="data")
deserializes from a binary file
Definition: serialization.h:247