B.1 Finding an Item

To quickly find an item by its full name trees and the use of iterators is not efficient. Therefore, an additional hash data structure is implemented. By a simple call to iiHashFindTreeNode the item is returned. This function is only used inside the Input Deck database and is not transparent to the user. Nevertheless, it is one of the key functions of the implementation. The declaration is given by

ipdTreeNode_t *iiHashFindTreeNode(const char *name);

The structure returned is of type ipdTreeNode_t, which is the generic Input Deck database data structure containing items.

The corresponding function of the application interface which performs parameter checking is

ipdTreeNode_t *ipdExistItemByName(const char *name,
                                  ipdType_t   itemType,
                                  bool        doFindAuxiliaries);

The parameter name is the name of the item to be found. The parameter itemType can be either ipdVARIABLE, ipdSECTION, or both (binary or'ed) to find an item which is either a variable, a section, or one of both. With the third parameter which is normally false, the programmer can specify if auxiliary variables have to be found as well. Auxiliary variables normally are invisible to the application. This is only useful for testing. The function returns a valid structure or 0 in case of an error.

Robert Klima 2003-02-06