template<typename PackType, typename Type, typename... AgentTypes>
struct fpmas::io::datapack::AgentPtrSerializer< PackType, Type, AgentTypes >
Generic AgentPtr serializer, that recursively deduces the final and concrete types of polymorphic AgentPtr instances.
- Template Parameters
-
| PackType | type of ObjectPack used for serialization |
| Type | type currently inspected |
| AgentTypes | agent types not inspected yet (must end with void) |
template<typename PackType , typename Type , typename... AgentTypes>
Recursive to_datapack method used to serialize the polymorphic Agent pointed by ptr into p.
Type corresponds to the currently examined Agent type. If this type id (i.e. Type::TYPE_ID) corresponds to the ptr Agent type (i.e. ptr->typedId()), the underlying agent is serialized using the specified PackType.
Else, attempts to recursively serialize ptr with AgentPtrSerializer<AgentTypes...>::to_datapack(p, ptr). Notice that the last value of AgentTypes must be void to reach the recursion base case (see to_datapack<void>).
- Parameters
-
| p | destination ObjectPack |
| ptr | polymorphic agent pointer to serialize |
template<typename PackType , typename Type , typename... AgentTypes>
Recursive from_datapack method used to unserialize polymorphic Agent pointers from ObjectPacks.
Type corresponds to the currently examined Agent type. If this type id (i.e. Type::TYPE_ID) corresponds to the ObjectPack type id value , the ObjectPack is unserialized using the specified PackType.
Else, attempts to recursively unserialize the ObjectPack with AgentPtrSerializer<AgentTypes...>::from_datapack(p, ptr). Notice that the last value of AgentTypes must be void to reach the recursion base case (see from_datapack<void>).
- Parameters
-
- Returns
- ptr unserialized polymorphic agent pointer