Class shared_memory::Serializer¶
-
template<class Serializable>
class shared_memory::Serializer¶ Public Functions
-
const std::string &serialize(const Serializable &serializable)¶
serialize an (almost) arbitrary instance to a string.
The method uses cereal internally and the instance must implement a serialize function. See for details: https://uscilab.github.io/cereal/ Supplementary requirements:
Serializable must also have a default constructor.
All instances of Serializable must be of the same size. (e.g. vectors must be of fixed size) The generated and returned string is a private member of the Serializer instance. Successive calls to serialize overwrite this string.
- Parameters
instance – to serialize to a string
-
void deserialize(const std::string &data, Serializable &serializable)¶
Restore the instance of serializable based on the string data, which should have been generated via the serialize function.
- Parameters
the – serialized instance
instance – of Serializable to be restored
Public Static Functions
-
static int serializable_size()¶
Returns the serialized size (i.e.
the size of the string) of an instance of Serializable
Private Members
-
std::string data_¶
-
const std::string &serialize(const Serializable &serializable)¶