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

#include <json_serializer.h>

Static Public Member Functions

static void to_json (light_json &, const fpmas::api::utils::PtrWrapper< AgentType > &)
 
static fpmas::api::utils::PtrWrapper< AgentType > from_json (const light_json &)
 

Detailed Description

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

A default light_serializer 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 json data is required to serialize / unserialize a light_json 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

◆ to_json()

template<typename AgentType >
static void fpmas::io::json::light_serializer< fpmas::api::utils::PtrWrapper< AgentType >, typename std::enable_if< std::is_base_of< fpmas::api::model::Agent, AgentType >::value &&std::is_default_constructible< AgentType >::value &&std::is_same< AgentType, typename AgentType::FinalAgentType >::value >::type >::to_json ( light_json ,
const fpmas::api::utils::PtrWrapper< AgentType > &   
)
inlinestatic

light_json to_json() implementation for the default constructible AgentType: nothing is serialized.

◆ from_json()

template<typename AgentType >
static fpmas::api::utils::PtrWrapper< AgentType > fpmas::io::json::light_serializer< fpmas::api::utils::PtrWrapper< AgentType >, typename std::enable_if< std::is_base_of< fpmas::api::model::Agent, AgentType >::value &&std::is_default_constructible< AgentType >::value &&std::is_same< AgentType, typename AgentType::FinalAgentType >::value >::type >::from_json ( const light_json )
inlinestatic

light_json from_json() 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: