![]() |
fpmas 1.5
|
#include <json_serializer.h>
Static Public Member Functions | |
| static FPMAS_TYPE_INDEX | register_type (const std::type_index &type) |
| template<typename JsonType > | |
| static std::type_index | from_json (const JsonType &j) |
| template<typename JsonType > | |
| static void | to_json (JsonType &j, const std::type_index &type) |
An nlohmann::adl_serializer specialization to allow JSON serialization of std:type_index, that is used as Agents TypeId.
Each registered std::type_index is automatically mapped to a unique std::size_t integer to allow serialization.
|
inlinestatic |
Register an std::type_index instance so that it can be serialized.
A unique integer id is internally associated to the type and used for serialization.
The fpmas::register_types() function template and the FPMAS_REGISTER_AGENT_TYPES(...) macro can be used to easily register types.
| type | type to register |
|
inlinestatic |
Unserializes an std::type_index instance from the specified JSON.
| j | json to unserialize |
| fpmas::exceptions::BadIdException | if the id does not correspond to a type registered using register_type() |
|
inlinestatic |
Serializes an std::type_index instance into the specified JSON.
| j | json instance |
| type | type to serialize |
| fpmas::exceptions::BadTypeException | if the type was not register using register_type() |