utils/include/serialize

Defines

FEASST_MAPPER_RENAME(class_name, serialize_name, args)

Create a static mapper for serialization of derived classes.

STRINGIFY(class_name)
FEASST_MAPPER(class_name, args)
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_serialize(const double val, std::ostream &ostr)

Serialize double. Handle zero.

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>
void feasst_serialize(const T &val, std::ostream &ostr)

Serialize generic to full precision.

template<typename T>
void feasst_deserialize(T *val, std::istream &istr)

Deserialize generic.

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 T1, typename T2>
void feasst_serialize(const std::pair<T1, std::vector<T2>> &container, std::ostream &ostr)

Serialize pair of T1 and T2 vector.

template<typename T1, typename T2>
void feasst_deserialize(std::pair<T1, std::vector<T2>> *container, std::istream &istr)

deserialize pair of T1 and T2 vector.

template<typename T1, typename T2>
void feasst_serialize(const std::pair<T1, T2> &container, std::ostream &ostr)

Serialize pair of T1 and T2.

template<typename T1, typename T2>
void feasst_deserialize(std::pair<T1, T2> *container, std::istream &istr)

deserialize pair of T1 and T2.

template<typename T>
void feasst_serialize(const std::vector<T> &vector, std::ostream &ostr)

Serialize the 1D vector.

template<typename T>
void feasst_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>
void feasst_serialize(const std::deque<T> &deque, std::ostream &ostr)

Serialize the 1D deque.

template<typename T>
void feasst_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>
void feasst_serialize_fstobj(const T &obj, std::ostream &ostr)

Serialize feasst object.

template<typename T>
void feasst_deserialize_fstobj(T *obj, std::istream &istr)

Deserialize feasst object.

template<typename T>
void feasst_serialize_fstobj(const std::vector<T> &vector, std::ostream &ostr)

Serialize vector of feasst objects.

template<typename T>
void feasst_deserialize_fstobj(std::vector<T> *vector, std::istream &istr)

Deserialize vector of feasst objects.

template<typename T>
void feasst_serialize_fstobj(const std::vector<std::vector<T>> &vector, std::ostream &ostr)

Serialize 2D vector of feasst objects.

template<typename T>
void feasst_deserialize_fstobj(std::vector<std::vector<T>> *vector, std::istream &istr)

Deserialize 2D vector of feasst objects.

void feasst_serialize_sp(const std::shared_ptr<double> ptr, std::ostream &ostr)

Serialize double stored as shared pointer.

void feasst_serialize_sp(const std::shared_ptr<int> ptr, std::ostream &ostr)

Serialize int stored as shared pointer.

template<typename T>
void feasst_serialize(const std::shared_ptr<T> ptr, std::ostream &ostr)

Serialize feasst object stored as shared pointer.

template<typename T>
void feasst_serialize(const std::unique_ptr<T> &ptr, std::ostream &ostr)

Serialize feasst object stored as unique pointer.

template<typename T>
void feasst_deserialize(std::unique_ptr<T> &ptr, std::istream &istr)

Deserialize feasst object stored as unique pointer.

template<typename T>
void feasst_serialize(const std::vector<std::unique_ptr<T>> &vector, std::ostream &ostr)

Serialize vector of unique pointers of feasst objects.

template<typename T>
void feasst_deserialize(std::vector<std::unique_ptr<T>> *vector, std::istream &istr)

Deserialize vector of unique pointers of feasst objects.

template<typename T>
void feasst_serialize_fstdr(std::shared_ptr<T> ptr, std::ostream &ostr)

Serialize feasst derived object stored as shared pointer.

template<typename T>
void feasst_serialize(const std::vector<std::shared_ptr<T>> &vector, std::ostream &ostr)

Serialize vector of shared pointers of feasst objects.

template<typename T>
void feasst_serialize_fstdr(const std::vector<std::shared_ptr<T>> &vector, std::ostream &ostr)

Deserialize vector of shared pointers of feasst objects.

Serialize vector of shared pointers of feasst derived objects

template<typename T>
void feasst_serialize(const std::map<std::string, std::shared_ptr<T>> &map, std::ostream &ostr)

Serialize a map of shared pointers of feasst objects.

template<typename T>
void feasst_deserialize(std::map<std::string, std::shared_ptr<T>> *map, std::istream &istr)

Deerialize a map of shared pointers of feasst objects.

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.