Menu

ImplementationDataStructure

Volkmar Glauche

Input Item Class Hierarchy

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.

cfg_item

All classes are derived from cfg_item and one of cfg_intree or cfg_leaf.

Within-tree items

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.

cfg_branch, cfg_exbranch

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.

cfg_choice

A choice item selects one of a choice of configuration subtrees.

cfg_repeat

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

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.

cfg_entry

The most versatile input item. It can hold any type of data.

cfg_file

Input item with fields to support file name filtering.

cfg_menu

Input item which allows to select from a choice of input values.

Tree Structure

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:

  • The root node of a tree should be a cfg_repeat or cfg_choice
  • The first non-cfg_repeat/cfg_choice item on a path in the tree should be a cfg_exbranch
  • On any path from the root to a leaf there is only one cfg_exbranch
  • Subscript assignment and reference enforce that cfg_item objects can not be concatenated into object arrays. Tree relationships can only be expressed by assigning cfg_item objects to .values or .val fields of within-tree items.

Input Item Class Methods

Basic methods

These methods implement standard MATLAB behaviour for each class as one would expect it from struct or cell variables, resp.

  • disp
  • display
  • subsref (present in each class, but identical code)
  • subsasgn (present only in cfg_item class)
  • setval (An interface to subsasgn to set val fields)
  • fieldnames

Helpers to basic methods

These methods implement class specific details of unified basic methods.

  • subs_fields
  • subsasgn_check

Tree traversal

These methods do basic tree traversal or support it.

  • treepart
  • match
  • list

Output struct handling

These methods import and export values to and from the struct.

  • initialise
  • harvest
  • gettag

Status query

  • all_set
  • all_set_item

Code generation and conversion

  • gencode
  • cfg2struct
  • cfg2jobsubs

Deprecated

  • expand

Dependency management

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.


Related

Wiki: space.menu

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.