![]() |
fpmas 1.6
|
#include <datapack.h>
Void Serializer definition. Specializations should implement the following methods:
static std::size_t size(const ObjectPack& p, const T& data)
Specifies the buffer size required to serialize data
into p
.
static void to_datapack(ObjectPack& p, const T& data)
Serializes data
into p
, typically using the put() method.
static T to_datapack(const ObjectPack& p)
Unserializes data
from p
, typically using the get() method.
The following method can be optionally implemented, if the buffer size required to serialize an instance of T does not depend on the instance of T itself (e.g. sizeof(int) + sizeof(char)
):
static std::size_t size(const ObjectPack& p)
Specifies the buffer size required to serialize any instance of T into p
. This enables the BasicObjectPack::size<T>() method usage for the type T.
Custom serializers can also be implemented. In this case, ObjectPack
arguments must be replaced by BasicObjectPack<S>
(or any equivalent typedef), where S is the currently implemented serializer (e.g. LightSerializer).
T | data type |
Enable | SFINAE condition |