Utopia  2
Framework for studying models of complex & adaptive systems.
Public Member Functions | Private Member Functions | List of all members
Utopia::DataIO::DataManagerFactory< Model > Class Template Reference

Factory function which produces a Datamanager of type Default::DefaultDataManager<Model> from a config and argumets from which to construct writetasks. More...

#include <factory.hh>

Public Member Functions

template<typename... Args>
auto operator() (const Config &conf, const std::tuple< Args... > &args, const Default::DefaultDecidermap< Model > &deciderfactories=Default::default_deciders< Model >, const Default::DefaultTriggermap< Model > &triggerfactories=Default::default_triggers< Model >)
 Builds a new datamanager from a config file and a tuple of tuples of arguments. More...
 

Private Member Functions

template<typename ArgTpl >
std::pair< std::string, std::shared_ptr< Default::DefaultWriteTask< Model > > > _call_taskfactory (std::string typetag, ArgTpl &&arg_tpl)
 Function which calls the taskfactory with argument tuples, and takes care of using the correct type-tags. More...
 

Detailed Description

template<class Model>
class Utopia::DataIO::DataManagerFactory< Model >

Factory function which produces a Datamanager of type Default::DefaultDataManager<Model> from a config and argumets from which to construct writetasks.

Template Parameters
ModelModeltype to use.
ArgsTuple types <TypeTag, std::string, argstypes_for_task...>
Parameters
modelReference to the model the produced datamanagere shall belong to
w_argsTuples, have to contain [tagtype, name, argumnets...]
Returns
auto DefaultDatamanager with DefaultWriteTasks produced from model

Member Function Documentation

◆ _call_taskfactory()

template<class Model >
template<typename ArgTpl >
std::pair< std::string, std::shared_ptr< Default::DefaultWriteTask< Model > > > Utopia::DataIO::DataManagerFactory< Model >::_call_taskfactory ( std::string  typetag,
ArgTpl &&  arg_tpl 
)
inlineprivate

Function which calls the taskfactory with argument tuples, and takes care of using the correct type-tags.

Template Parameters
ArgTplautomatically determined
Parameters
typetagstring indicating which type tag to use
arg_tpltuple of arguments to invoke the taskfactory with
Returns
Default::DefaultWriteTask<Model> produced by invoking the TaskFactory with the passed argument tuple

◆ operator()()

template<class Model >
template<typename... Args>
auto Utopia::DataIO::DataManagerFactory< Model >::operator() ( const Config conf,
const std::tuple< Args... > &  args,
const Default::DefaultDecidermap< Model > &  deciderfactories = Default::default_deciders<Model>,
const Default::DefaultTriggermap< Model > &  triggerfactories = Default::default_triggers<Model> 
)
inline

Builds a new datamanager from a config file and a tuple of tuples of arguments.

The latter are supplemented by the arguments given by the config, and then passed to the writetask factory, each. The result is then used for creating the datamanager. The arguments that need to be supplied in the code are

  • function which returns the data source, preferably by reference. Mind that you need to use decltype(auto) as return type if using a lambda.
  • the getter function which extracts data from the sources values, same thing as employed by dataset->write.
  • callable to write group attribute or tuple containing (name, data) or 'Nothing{}' if no attributes are desired
  • callable to write dataset attribute or tuple containing (name, data) or 'Nothing{}' if no attributes are desired
Template Parameters
Argsautomatically determined
Parameters
confconfig node giving the 'data_manager' configuration nodes
argstuple of argument tuples
Returns
auto DefaultDatamanager<Model> with the tasks built from config and arguments

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