|
Utopia 2
Framework for studying models of complex & adaptive systems.
|
Functor for building a writetask from arguments. More...
#include <factory.hh>
Public Member Functions | |
| template<class SourceGetter , class Getter , class Group_attribute = Nothing, class Dataset_attribute = Nothing> | |
| std::pair< std::string, std::shared_ptr< Default::DefaultWriteTask< Model > > > | operator() (std::string name, std::string basegroup_path, DatasetDescriptor dataset_descriptor, SourceGetter &&get_source, Getter &&getter, Group_attribute &&group_attribute=Nothing{}, Dataset_attribute &&dataset_attribute=Nothing{}) |
| Basic factory function producing Default::DefaultWriteTask<Model> intstances, for writing out data. It is inteded to make the setup of a WriteTask simpler for common cases. | |
| std::pair< std::string, std::shared_ptr< Default::DefaultWriteTask< Model > > > | operator() (std::string name, Default::DefaultBaseGroupBuilder group_builder, Default::DefaultDataWriter< Model > writer, Default::DefaultBuilder< Model > dataset_builder, Default::DefaultAttributeWriterGroup< Model > group_attr, Default::DefaultAttributeWriterDataset< Model > dset_attr) |
| Thin wrapper around the writetask constructor which allows to construct a writetask via the factory by providing all the functions the latter employs by hand. This is intended for cases where the other operator() is too restrictive. | |
Private Member Functions | |
| template<class Func , class AttributeHandle > | |
| Func | _make_attribute_writer (AttributeHandle &&attr) |
| Function which produces functions for writing attributes to a dataset or group, and which are used by a writer task to write attributes to the dataset and basegroup it creates. | |
| Default::DefaultBuilder< Model > | _make_dataset_builder (DatasetDescriptor dataset_descriptor) |
| Function producing a dataset builder function of type Default::DefaultBuilder<Model>, which is responsible for creating new HDF5 datasets on request. | |
| template<class SourceGetter , class Getter > | |
| Default::DefaultDataWriter< Model > | _adapt_graph_writer (SourceGetter &&get_source, Getter &&getter) |
| Function which adapts getter functions for the correct graph accessor type, i.e., vertex_descriptor etc. | |
Static Private Attributes | |
| static std::unordered_map< std::string, std::function< std::string(std::string, Model &) > > | _modifiers |
| Initialization of the modifier map. | |
Functor for building a writetask from arguments.
| Model | Model type. |
| TypeTag::plain | Typetag, indicates what type of data source is used, has only to be changed when using graphs. |
|
inlineprivate |
Function which adapts getter functions for the correct graph accessor type, i.e., vertex_descriptor etc.
| SourceGetter | automatically determined |
| Getter | automatically determined |
| get_source | Function which extracts the source to get data from from its superior structure, e.g., extracting a vertex list from a graph |
| getter | Function which extracts the data to write from the source, e.g., from the vertex |
|
inlineprivate |
Function which produces functions for writing attributes to a dataset or group, and which are used by a writer task to write attributes to the dataset and basegroup it creates.
| Func | Function type to produce |
| Attribute | automatically determined |
| attr | Either 'Nothing' if no attributes shall be written, or a tuple/pair (name, attribute_data) or a function convertible to type Func which takes care of writing dataset attributes, and receives a reference to a model as argument |
|
inlineprivate |
Function producing a dataset builder function of type Default::DefaultBuilder<Model>, which is responsible for creating new HDF5 datasets on request.
| dataset_descriptor | Describes dataset properties. |
|
inline |
Thin wrapper around the writetask constructor which allows to construct a writetask via the factory by providing all the functions the latter employs by hand. This is intended for cases where the other operator() is too restrictive.
| name | Name of the task to be build |
| group_builder | Function to build a HDFGroup to store datasets in |
| writer | Function which writes out data |
| dataset_builder | Function to build Datasets |
| group_attr | Function writing attributes to the task's base group |
| dset_attr | Function writing attrbutes to the task's currently active dataset |
|
inline |
Basic factory function producing Default::DefaultWriteTask<Model> intstances, for writing out data. It is inteded to make the setup of a WriteTask simpler for common cases.
| Model | The model class the task refers to. The model is the ultimate source of data in utopia context, hence has to be given. |
| SourceGetter | A container type, in this context something which has an iterator, automatically determined. |
| Getter | Unary function type getting SourceGetter::value_type as argument and returning data to be written, automatically determined. |
| Group_attribute | Either callable of type Default::GroupAttributeWriter or a tuplelike object. |
| Dataset_attribute | Either callable of type Default::DatasetAttributeWriter or a tuplelike object. |
| name | String naming this task, to be used with config. |
| basegroup_path | Path in the HDF5 file to the base_group this task stores its produced datasets in. |
| get_source | Function which returns a container or graph holding the data to use for write |
| getter | Unary function getting a SourceGetter::value_type argument and returning data to be written. |
| dataset_descriptor | DatasetDescriptor instance which gives the properties constructed datasets should have, at the very least its path in the basegroup. |
| group_attribute | Either a callable of type DefaultGroupAttributeWriter or a tuplelike object containing [attribute_name, attribute_data]. Usually, the latter is a descriptive string. The last possiblity is to give 'Nothing', which means that the Attribute should be ignored |
| dataset_attribute | Either a callable of type DefaultGroupAttributeWriter or some a tuplelike object containing [attribute_name, attribute_data]. Usually, the latter is a descriptive string. The last possiblity is to give 'Nothing', which means that the Attribute should be ignored |