fpmas 1.5
Static Public Member Functions | List of all members
fpmas::io::datapack::LightSerializer< fpmas::api::utils::PtrWrapper< AgentType >, typename std::enable_if< std::is_base_of< api::model::Agent, AgentType >::value &&std::is_default_constructible< AgentType >::value &&std::is_same< AgentType, typename AgentType::FinalAgentType >::value >::type > Struct Template Reference

#include <datapack_serializer.h>

Static Public Member Functions

static std::size_t size (const LightObjectPack &, const api::utils::PtrWrapper< AgentType > &)
 
static void to_datapack (LightObjectPack &, const api::utils::PtrWrapper< AgentType > &)
 
static api::utils::PtrWrapper< AgentType > from_datapack (const LightObjectPack &)
 

Detailed Description

template<typename AgentType>
struct fpmas::io::datapack::LightSerializer< fpmas::api::utils::PtrWrapper< AgentType >, typename std::enable_if< std::is_base_of< api::model::Agent, AgentType >::value &&std::is_default_constructible< AgentType >::value &&std::is_same< AgentType, typename AgentType::FinalAgentType >::value >::type >

A default LightSerializer specialization for default constructible Agent types.

When a default constructor is available for AgentType, this specialization is automatically selected.

The usage of this specialization is recommended, since its optimal: no data is required to serialize / unserialize a LightObjectPack representing such an AgentType. Moreover, its usage is perfectly safe since AgentType instanciated this way are never used directly within FPMAS (at least a complete ObjectPack import is realized before accessing AgentType data, using a ReadGuard for example).

Template Parameters
AgentTypeconcrete type of Agent to serialize

Member Function Documentation

◆ size()

template<typename AgentType >
static std::size_t fpmas::io::datapack::LightSerializer< fpmas::api::utils::PtrWrapper< AgentType >, typename std::enable_if< std::is_base_of< api::model::Agent, AgentType >::value &&std::is_default_constructible< AgentType >::value &&std::is_same< AgentType, typename AgentType::FinalAgentType >::value >::type >::size ( const LightObjectPack ,
const api::utils::PtrWrapper< AgentType > &   
)
inlinestatic

Returns the size required to serialize an Agent into a LightObjectPack, i.e. 0 since the AgentType is default constructed in this case.

◆ to_datapack()

template<typename AgentType >
static void fpmas::io::datapack::LightSerializer< fpmas::api::utils::PtrWrapper< AgentType >, typename std::enable_if< std::is_base_of< api::model::Agent, AgentType >::value &&std::is_default_constructible< AgentType >::value &&std::is_same< AgentType, typename AgentType::FinalAgentType >::value >::type >::to_datapack ( LightObjectPack ,
const api::utils::PtrWrapper< AgentType > &   
)
inlinestatic

LightObjectPack to_datapack() implementation for the default constructible AgentType: nothing is serialized.

◆ from_datapack()

template<typename AgentType >
static api::utils::PtrWrapper< AgentType > fpmas::io::datapack::LightSerializer< fpmas::api::utils::PtrWrapper< AgentType >, typename std::enable_if< std::is_base_of< api::model::Agent, AgentType >::value &&std::is_default_constructible< AgentType >::value &&std::is_same< AgentType, typename AgentType::FinalAgentType >::value >::type >::from_datapack ( const LightObjectPack )
inlinestatic

LightObjectPack from_datapack() implementation for the default constructible AgentType: a dynamically allocated, default constructed AgentType is returned.

Returns
dynamically allocated AgentType

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