Provides a number of helper functions for the datamanager class.
More...
|
template<class ValType , class KVPairs , class ObjMap > |
void | Utopia::DataIO::_DMUtils::unpack_shared (KVPairs &&kv_pairs, ObjMap &&map) |
| Helper function to unpack (key, value) container into a map of shared pointers of a type. More...
|
|
template<class ObjMap , class ValType , class KVPairs > |
ObjMap | Utopia::DataIO::_DMUtils::unpack_shared (KVPairs &&kv_pairs) |
| Helper function to unpack (key, value) container into an empty map of shared pointers of a type. More...
|
|
template<class AssocsMap , class NamedTasks , class NamedDTMap , class Assocs > |
AssocsMap | Utopia::DataIO::_DMUtils::build_task_association_map (const NamedTasks &tasks, const NamedDTMap &named_dts, Assocs assocs=Assocs{}) |
| Build an association map, i.e., a map that associates a decider/trigger name with a collection of tasknames. More...
|
|
Provides a number of helper functions for the datamanager class.
Here some utility functions for the datamanager are implemented.
◆ build_task_association_map()
template<class AssocsMap , class NamedTasks , class NamedDTMap , class Assocs >
AssocsMap Utopia::DataIO::_DMUtils::build_task_association_map |
( |
const NamedTasks & |
tasks, |
|
|
const NamedDTMap & |
named_dts, |
|
|
Assocs |
assocs = Assocs{} |
|
) |
| |
Build an association map, i.e., a map that associates a decider/trigger name with a collection of tasknames.
The Association Map is built from a map that associates names to tasks, a map that associates names and deciders/triggers, and a map or vector of pairs that associates each taskname with the name of a trigger/decider functor. If this last argument is not given, then a bijective association is attempted in which each task is associated with a trigger/decider that correponds to its position in the "named_dts" argument. This means that "tasks" and "named_dts" needs to be of equal length. If this is violated the function throws. If the "assocs" argument is given, the requirement of equal length is not necessary, because it specifies this bijective mapping. Note that this means that the "assocs" argument maps one decider/triggername to a taskname, and tasknames may repeat, while decider/triggernames do not.
- Template Parameters
-
AssocsMap | Final map that maps names of deciders/triggers to a collection of task names |
NamedTasks | automatically determined |
NamedDTMap | automatically determined |
Assocs | automatically determined |
- Parameters
-
tasks | map or vector of pairs containing (name, task). |
named_dts | map or vector of pairs containing (name, decider/trigger) |
assocs | map or vector of pairs containing (taskname, decider-/triggername). |
- Returns
- AssocsMap Map that maps a name of a decider/trigger to a vector of tasknames. This argument is optional: If it is not given, then the function will try to associate tasks and deciders/triggers one by one in a bijective way in the order given. If that fails, an error is thrown.
◆ unpack_shared() [1/2]
template<class ObjMap , class ValType , class KVPairs >
ObjMap Utopia::DataIO::_DMUtils::unpack_shared |
( |
KVPairs && |
kv_pairs | ) |
|
Helper function to unpack (key, value) container into an empty map of shared pointers of a type.
- Template Parameters
-
ObjMap | The name -> object map to create |
ValType | Used in make_shared<ValType> call |
KVPairs | Container of (key, value) pairs. Can also be a tuple. |
- Parameters
-
kv_pairs | The container of (key, value) pairs to unpack into a new map of type ObjMap |
- Returns
- ObjMap The newly created and populated map
◆ unpack_shared() [2/2]
template<class ValType , class KVPairs , class ObjMap >
void Utopia::DataIO::_DMUtils::unpack_shared |
( |
KVPairs && |
kv_pairs, |
|
|
ObjMap && |
map |
|
) |
| |
Helper function to unpack (key, value) container into a map of shared pointers of a type.
- Template Parameters
-
ValType | Used in make_shared<ValType> call |
KVPairs | Container of (key, value) pairs. Can also be a tuple. |
ObjMap | The name -> object map type |
- Parameters
-
kv_pairs | The container of (key, value) pairs to unpack into a new map of type ObjMap |