![]() |
fpmas 1.6
|
#include <model.h>
Static Public Member Functions | |
static std::size_t | size (const LightObjectPack &pack, const AgentPtr &ptr) |
static void | to_datapack (LightObjectPack &pack, const AgentPtr &pointer) |
static AgentPtr | from_datapack (const LightObjectPack &pack) |
fpmas::api::model::AgentPtr fpmas::io::datapack::LightSerializer serialization rules declaration.
to_datapack
and from_datapack
methods must be defined by the user at compile time, depending on its own Agent types, using the FPMAS_DATAPACK_SET_UP() macro, that must be called from a source file. Otherwise, linker errors will be thrown.
|
static |
Returns the buffer size required to serialize the polymorphic Agent pointed by ptr
into p
.
|
static |
Serializes the Agent represented by pointer
to the specified LightObjectPack.
The LightObjectPack version of the to_datapack() method attempts to serialize the agent with the less data possible, i.e. possibly nothing if the Agent is default constructible, and no user defined LightObjectPack serialization rules have been provided.
If Agent is not default constructible, the classic io::datapack::Serializer<PtrWrapper<AgentType>>
is used, what might be inefficient.
pack | destination LightObjectPack |
pointer | pointer to polymorphic Agent |
|
static |
Unserializes an Agent from the specified LightObjectPack.
The built Agent is dynamically allocated, but is automatically managed by the fpmas::api::model::AgentPtr wrapper.
Since Agent is polymorphic, the concrete type that should be instantiated from the input LightObjectPack is determined at runtime.
The LightObjectPack version of the from_datapack() method attempts to build the Agent using a default constructor, to bypass the classical ObjectPack serialization process.
If Agent is not default constructible, the classic io::datapack::Serializer<PtrWrapper<AgentType>>
is used, what might be inefficient.
pack | source LightObjectPack |
o
, wrapped in an fpmas::api::model::AgentPtr instance