The configuration data structure is based on classes that hold necessary input data to run a job and a few methods to set, query and extract these data.
All classes are derived from cfg_item and one of cfg_intree or cfg_leaf.
These items determine the internal structure of the produced module input. Items that will become part of the module input are held in .val field, while possible choices of items are held in .values field. Thus, for within-tree items, traveling down the .val part of the tree always leads to current input items, whereas the route through the .values part leads to possible alternative parts of the configuration tree (which may contain default settings).
The items are derived both from cfg_item and cfg_intree. The latter class is (currently) only a marker class without own fields and methods. This may change in future, since there are many methods that are common to all in-tree items.
A branch item collects a fixed number of other cfg_items in a fixed order. A special case is an executable branch, which contains function handles to run a user specified function based on inputs from this branch.
A choice item selects one of a choice of configuration subtrees.
A repeat item selects one or more of a choice of configuration subtrees. The difference between choice and repeat is in the resulting data structure on output.
Data entry items represent the leaf level of the configuration tree. They are derived from both cfg_item and cfg_leaf classes. The latter class has (similar to cfg_intree) no methods and fields, it is just a marker class.
Input values are stored in .val{1}. They can be anything, some data integrity is enforced in subscript assignment.
The most versatile input item. It can hold any type of data.
Input item with fields to support file name filtering.
Input item which allows to select from a choice of input values.
The items are designed to support a tree-like configuration structure. In general each within-tree item can appear anywhere in the tree. Currently there is a convention used throughout the data structure and management that makes it necessary to obey the following rules:
These methods implement standard MATLAB behaviour for each class as one would expect it from struct or cell variables, resp.
These methods implement class specific details of unified basic methods.
These methods do basic tree traversal or support it.
These methods import and export values to and from the struct.
There is a dependency class cfg_dep that allows to link output from one cfg_exbranch to inputs of other cfg_exbranches. Dependency methods ensure that links are updated if either a source or a target of a dependency change (currently, dependencies are simply recursively dropped if necessary). However, there is no protection against circular dependencies.