template<typename SpatialAgentInterface, typename AgentType, typename CellType, typename Derived>
struct fpmas::io::datapack::Serializer< PtrWrapper< fpmas::model::SpatialAgentBase< SpatialAgentInterface, AgentType, CellType, Derived > > >
Polymorphic SpatialAgentBase ObjectPack serializer specialization.
| Serialization Scheme |
Derived ObjectPack serialization | SpatialAgentBase::locationId() |
The Derived part is serialized using the Serializer<PtrWrapper<Derived>> serialization, that can be defined externally without additional constraint. The input GridAgent pointer is cast to Derived when required to call the proper Serializer specialization.
- Template Parameters
-
| AgentType | final fpmas::api::model::SpatialAgent type to serialize |
| CellType | type of cells used by the spatial model |
| Derived | next derived class in the polymorphic serialization chain |
template<typename SpatialAgentInterface , typename AgentType , typename CellType , typename Derived >
Unserializes a polymorphic SpatialAgentBase from the specified ObjectPack.
First, the Derived part, that extends SpatialAgentBase by definition, is unserialized using the Serializer<fpmas::api::utils::PtrWrapper<Derived> specialization. During this operation, a Derived instance is dynamically allocated, that might leave the SpatialAgentBase members undefined. The specific SpatialAgentBase member location_id is then unserialized, and the unserialized Derived instance is returned in the form of a polymorphic SpatialAgentBase pointer.
- Parameters
-
- Returns
- unserialized pointer to a polymorphic
SpatialAgentBase