![]() |
fpmas 1.5
|
#include <datapack_serializer.h>
Static Public Member Functions | |
| static FPMAS_TYPE_INDEX | register_type (const std::type_index &type) |
| template<typename PackType > | |
| static FPMAS_TYPE_INDEX | size (const PackType &pack) |
| template<typename PackType > | |
| static FPMAS_TYPE_INDEX | size (const PackType &o, const std::type_index &) |
| template<typename PackType > | |
| static void | to_datapack (PackType &pack, const std::type_index &index) |
| template<typename PackType > | |
| static std::type_index | from_datapack (const PackType &pack) |
A Serializer specialization to allow ObjectPack serialization of std:type_index, that is used as Agents TypeId.
Each registered std::type_index is automatically mapped to a unique std::size_t integer to allow serialization.
|
inlinestatic |
Register an std::type_index instance so that it can be serialized.
A unique integer id is internally associated to the type and used for serialization.
The fpmas::register_types() function template and the FPMAS_REGISTER_AGENT_TYPES(...) macro can be used to easily register types.
| type | type to register |
|
inlinestatic |
Returns the buffer size required to serialize an std::type_index instance, i.e. pack.size<FPMAS_TYPE_INDEX>();
|
inlinestatic |
Equivalent to size().
|
inlinestatic |
Serializes an std::type_index instance into the specified ObjectPack.
| pack | destination BasicObjectPack |
| index | type index to serialize |
| fpmas::exceptions::BadTypeException | if the type was not register using register_type() |
|
inlinestatic |
Unserializes an std::type_index instance from the specified ObjectPack.
| pack | source BasicObjectPack |
| fpmas::exceptions::BadIdException | if the id does not correspond to a type registered using register_type() |