fpmas 1.5
Static Public Member Functions | List of all members
nlohmann::adl_serializer< fpmas::api::model::AgentPtr > Struct Reference

#include <model.h>

Static Public Member Functions

static void to_json (json &j, const fpmas::api::model::AgentPtr &pointer)
 
static fpmas::api::model::AgentPtr from_json (const json &j)
 

Detailed Description

fpmas::api::model::AgentPtr nlohmann::json serialization rules declaration.

to_json and from_json methods must be defined by the user at compile time, depending on its own Agent types, using the FPMAS_JSON_SET_UP() macro, that must be called from a source file. Otherwise, linker errors will be thrown.

Member Function Documentation

◆ to_json()

static void nlohmann::adl_serializer< fpmas::api::model::AgentPtr >::to_json ( json &  j,
const fpmas::api::model::AgentPtr pointer 
)
static

Serializes the Agent represented by pointer to the specified json j.

Notice that since Agent is polymorphic, the actual to_json call that corresponds to the most derived type of the specified Agent is resolved at runtime.

Parameters
jjson output
pointerpointer to polymorphic Agent

◆ from_json()

static fpmas::api::model::AgentPtr nlohmann::adl_serializer< fpmas::api::model::AgentPtr >::from_json ( const json &  j)
static

Unserializes an Agent from the specified JSON j.

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 json j is determined at runtime.

Parameters
jinput json
Returns
dynamically allocated Agent, unserialized from j, wrapped in an fpmas::api::model::AgentPtr instance

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