B.5 Iterators

For the Input Deck application interface iterators are available. Iterators of the Input Deck database are objects which are used to explore the hierarchy of section trees. The main application field of iterators is to find all elements defined in a section and to analyze the sequence the elements have been defined. To create iterators several functions can be used, the most popular is

bool ipdIteratorSetNewByName(ipdIterator_t **iNode_p, 
                             const char     *itemName, 
                             ipdType_t       searchType,
                             ipdType_t       setType);

which creates an iterator of the type ipdIterator_t by a name and search rules, e.g., to restrict the iteration to variables or sections only. To reset an existing iterator, the function

bool ipdIteratorSetByName(ipdIterator_t *iNode,
                          const char    *itemName,
                          ipdType_t      searchType,
                          ipdType_t      setType);

can be used which works similar to ipdIteratorSetNewByName but does not create a new iterator.

For the movement inside the tree several functions exist, such as

bool ipdIteratorDoPrev         (ipdIterator_t *iNode);
bool ipdIteratorDoNext         (ipdIterator_t *iNode);
bool ipdIteratorDoStep         (ipdIterator_t *iNode);
bool ipdIteratorGoUp           (ipdIterator_t *iNode);
bool ipdIteratorGotoRootSection(ipdIterator_t *iNode);

where ipdIteratorDoPrev and ipdIteratorDoPrev are used to move forwards and backwards within the same level inside a certain section. ipdIteratorDoStep, ipdIteratorGoUp, and ipdIteratorGotoRootSection are used to step inside a section, to jump upwards to the parent section, or to jump to the root section, respectively.

Robert Klima 2003-02-06