fpmas 1.6
Classes | Namespaces | Macros
datapack_serializer.h File Reference
#include "serializer_set_up.h"
#include "fpmas/api/model/model.h"
#include "fpmas/io/datapack.h"
#include "fpmas/model/model.h"
Include dependency graph for datapack_serializer.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  fpmas::io::datapack::Serializer< std::type_index >
 
struct  fpmas::io::datapack::Serializer< api::utils::PtrWrapper< AgentType > >
 
struct  fpmas::io::datapack::LightSerializer< 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  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  fpmas::io::datapack::AgentPtrSerializer< PackType, void >
 
struct  fpmas::io::datapack::AgentPtrSerializer< PackType, Type, AgentTypes >
 

Namespaces

namespace  fpmas
 
namespace  fpmas::io
 
namespace  fpmas::io::datapack
 

Macros

#define FPMAS_BASE_DATAPACK_SET_UP(...)
 
#define FPMAS_BASE_DEFAULT_DATAPACK_SET_UP()
 
#define FPMAS_DEFAULT_DATAPACK(AGENT)
 

Detailed Description

Agent ObjectPack serialization related objects.

Macro Definition Documentation

◆ FPMAS_BASE_DATAPACK_SET_UP

#define FPMAS_BASE_DATAPACK_SET_UP (   ...)

Defines the fpmas::io::datapack::Serializer specializations required to handle the object pack serialization of the specified set of Agent types.

Notice that this is only the definitions of the to_datapack and from_datapack methods, that are declared (but not defined) in src/fpmas/model/model.h.

In consequence, this macro must be invoked exaclty once from a source file, at the global definition level, in any C++ target using FPMAS.

This macro does not define any rule for AgentPtr json serialization, so using only this macro will produce compile time errors.

Two solutions are available:

  • calling FPMAS_BASE_JSON_SET_UP() and FPMAS_BASE_DATAPACK_SET_UP(). This enable both AgentPtr serialization techniques, but to_json() and from_json() methods must be specified for all agents, in addition to the to_datapack() and from_datapack() methods.
  • just calling FPMAS_DATAPACK_SET_UP(), instead of FPMAS_BASE_DATAPACK_SET_UP(). This also enable both serialization techniques, but json serialization falls back to object pack serialization. This might be inefficient, but only requires to_datapack() and from_datapack() definitions.
See also
FPMAS_BASE_JSON_SET_UP()
FPMAS_DATAPACK_SET_UP()
FPMAS_JSON_SET_UP()

◆ FPMAS_BASE_DEFAULT_DATAPACK_SET_UP

#define FPMAS_BASE_DEFAULT_DATAPACK_SET_UP ( )

Can be used instead of FPMAS_BASE_DATAPACK_SET_UP() to set up json serialization without specifying any Agent type.

◆ FPMAS_DEFAULT_DATAPACK

#define FPMAS_DEFAULT_DATAPACK (   AGENT)

Helper macro to easily define object pack serialization rules for DefaultConstructible Agents.

Parameters
AGENTDefaultConstructible Agent type