fpmas 1.6
Static Public Member Functions | List of all members
fpmas::io::datapack::Serializer< AgentPtr > Struct Reference

#include <model.h>

Static Public Member Functions

static std::size_t size (const ObjectPack &p, const AgentPtr &ptr)
 
static void to_datapack (ObjectPack &pack, const AgentPtr &pointer)
 
static AgentPtr from_datapack (const ObjectPack &pack)
 

Detailed Description

fpmas::api::model::AgentPtr fpmas::io::datapack::Serializer 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.

Member Function Documentation

◆ size()

static std::size_t fpmas::io::datapack::Serializer< AgentPtr >::size ( const ObjectPack p,
const AgentPtr ptr 
)
static

Returns the buffer size required to serialize the polymorphic Agent pointed by ptr to p.

◆ to_datapack()

static void fpmas::io::datapack::Serializer< AgentPtr >::to_datapack ( ObjectPack pack,
const AgentPtr pointer 
)
static

Serializes the polymorphic Agent pointed by pointer to the specified ObjectPack.

Parameters
packdestination ObjectPack
pointerpointer to polymorphic Agent

◆ from_datapack()

static AgentPtr fpmas::io::datapack::Serializer< AgentPtr >::from_datapack ( const ObjectPack pack)
static

Unserializes an Agent from the specified ObjectPack.

Since Agent is polymorphic, the concrete type that should be instantiated from the input ObjectPack is determined at runtime.

The built Agent is dynamically allocated, but is automatically managed by the fpmas::api::model::AgentPtr wrapper.

Parameters
packsource ObjectPack
Returns
dynamically allocated Agent, unserialized from pack, wrapped in an fpmas::api::model::AgentPtr instance

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