utils/include/serialize¶
-
namespace
feasst
Functions
-
void
feasst_serialize
(const bool val, std::ostream &ostr)¶ Utility functions for serialization of objects into human-readable character streams. Each serialization function has an accompying deserialization function which performs the inverse operation.
Note that some deserialization functions of derived objects do not work as the commented templates. But when the source code is copied to the specific object’s deserialization function, then it does work, for unknown reasons.
For this function, serialize a boolean value.
-
void
feasst_deserialize
(bool *val, std::istream &istr)¶ Deserialize bool.
-
void
feasst_serialize
(const std::string str, std::ostream &ostr)¶ Serialize string.
-
void
feasst_deserialize
(std::string *str, std::istream &istr)¶ Deserialize string.
-
void
feasst_deserialize
(double *val, std::istream &istr)¶ Deserialize double. Handle inf.
-
void
feasst_serialize
(const long double &val, std::ostream &ostr)¶ Serialize long double.
-
void
feasst_deserialize
(long double *val, std::istream &istr)¶ Deserialize long double. Handle inf.
-
void
feasst_serialize
(const argtype &args, std::ostream &ostr)¶ Serialize argtype.
-
void
feasst_deserialize
(argtype *args, std::istream &istr)¶ Deserialize argtype.
-
template<typename
T
>
voidfeasst_serialize
(const T &val, std::ostream &ostr)¶ Serialize generic to full precision.
-
void
feasst_serialize_version
(const int version, std::ostream &ostr)¶ Serialize object version.
-
int
feasst_deserialize_version
(std::istream &istr)¶ Deserialize object version.
-
template<typename
T
>
voidfeasst_serialize
(const std::pair<int, std::vector<T>> &container, std::ostream &ostr)¶ Serialize pair of int and vector.
-
template<typename
T
>
voidfeasst_deserialize
(std::pair<int, std::vector<T>> *container, std::istream &istr)¶ deserialize pair of int and vector.
-
template<typename
T
>
voidfeasst_serialize
(const std::vector<T> &vector, std::ostream &ostr)¶ Serialize the 1D vector.
-
template<typename
T
>
voidfeasst_deserialize
(std::vector<T> *vector, std::istream &istr)¶ Deserialize the 1D vector.
-
void
feasst_serialize
(const std::vector<double> &vector, std::ostream &ostr)¶ Serialize 1D vector of doubles.
-
void
feasst_deserialize
(std::vector<double> *vector, std::istream &istr)¶ Deserialize 1D vector of doubles.
-
void
feasst_serialize
(const std::vector<long double> &vector, std::ostream &ostr)¶ Serialize 1D vector of long doubles.
-
void
feasst_deserialize
(std::vector<long double> *vector, std::istream &istr)¶ Deserialize 1D vector of long doubles.
-
template<typename
T
>
voidfeasst_serialize
(const std::deque<T> &deque, std::ostream &ostr)¶ Serialize the 1D deque.
-
template<typename
T
>
voidfeasst_deserialize
(std::deque<T> *deque, std::istream &istr)¶ Deserialize the 1D deque.
-
void
feasst_deserialize
(std::vector<bool> *vector, std::istream &istr)¶ Deserialize the boolean 1D vector.
-
void
feasst_deserialize
(std::vector<std::vector<bool>> *vector, std::istream &istr)¶ Deserialize the boolean 2D vector.
-
template<typename
T
>
voidfeasst_serialize_fstobj
(const T &obj, std::ostream &ostr)¶ Serialize feasst object.
-
template<typename
T
>
voidfeasst_deserialize_fstobj
(T *obj, std::istream &istr)¶ Deserialize feasst object.
-
template<typename
T
>
voidfeasst_serialize_fstobj
(const std::vector<T> &vector, std::ostream &ostr)¶ Serialize vector of feasst objects.
-
template<typename
T
>
voidfeasst_deserialize_fstobj
(std::vector<T> *vector, std::istream &istr)¶ Deserialize vector of feasst objects.
-
template<typename
T
>
voidfeasst_serialize_fstobj
(const std::vector<std::vector<T>> &vector, std::ostream &ostr)¶ Serialize 2D vector of feasst objects.
-
template<typename
T
>
voidfeasst_deserialize_fstobj
(std::vector<std::vector<T>> *vector, std::istream &istr)¶ Deserialize 2D vector of feasst objects.
Serialize double stored as shared pointer.
Serialize int stored as shared pointer.
Serialize feasst object stored as shared pointer.
Deserialize feasst object stored as shared pointer.
Serialize feasst derived object stored as shared pointer.
Serialize vector of shared pointers of feasst objects.
Deserialize vector of shared pointers of feasst objects.
Serialize vector of shared pointers of feasst derived objects.
- Parameters
rewind
: Rewind istr position to read class name again (default: false).
Return a shared pointer to the base class of model after construction of the full derived class. see https://isocpp.org/wiki/faq/serialization
Return a deep copy of a feasst derived class object. This is implemented via serialization/deserialization.
-
template<typename
T
>
Tdeep_copy
(const T &object)¶ Return a deep copy. This is implemented via serialization/deserialization.
-
void
feasst_serialize_endcap
(const std::string name, std::ostream &ostr)¶ End class serialization with this notification to aid debugging.
-
void
feasst_deserialize_endcap
(const std::string name, std::istream &istr)¶ Read end notification to aid debugging.
-
void