MIRA
BinarySerializerTag Struct Reference

Serializer that uses BinaryOstream to serialize the objects in binary format. More...

#include <serialization/BinarySerializer.h>

Detailed Description

Serializer that uses BinaryOstream to serialize the objects in binary format.

It can be used for streaming data to tapes, for streaming data using TCP, or for serializing the data into a binary buffer. Depending on the used binary stream, properties like network byte order can be specified via the binary stream object.

Since this serializer operates on a BinaryOstream, it comes in two flavors:

This serializer has a special serialize() method that supports storing type information for better type safety.

Example usage for BinaryBufferSerializer:

#include <serialization/adapters/std/vector>
// the data to be serialized
std::vector<int> myValue;
...
// create a serializer that writes into a buffer
Buffer<uint8> buffer;
BinaryBufferSerializer serializer(&buffer);
// serialize the data
serializer.serialize(myValue);
// buf now contains the serialized data.

Example usage for BinaryStreamSerializer:

#include <serialization/adapters/std/vector>
// the data to be serialized
std::vector<int> myValue;
...
// create a binary serializer that writes into a file stream
ofstream ofs("myfile.bin");
BinaryStreamSerializer serializer(bos);
// serialize the data
serializer.serialize(myValue);

For the deserialization of binary content see BinaryDeserializer.

See also
Serialization, BinaryOstream, BinaryDeserializer

The documentation for this struct was generated from the following file: