UMap(3U) InterViews Reference Manual UMap(3U)
UMap - maintains a mapping between two sets of pointers
UMap is an abstract class for objects that store an arbitrary number of pointer pairs and can search to find either member of a pair given
the other. A UMapElem object stores each pointer pair in the UMap. UMapElem is an abstract class that defines virtuals for returning
either member of the pair, referred to as the id and the tag. Subclasses of UMapElem redefine these virtuals to return either member of
the pair they store.
UMAPELEM PUBLIC OPERATIONS
The base class constructor does nothing by default.
virtual void* id()
virtual void* tag()
Return the id or the tag that the UMapElem stores. Subclasses typically define two member variables that store pair's values and
redefine these operations to return them.
UMAP PUBLIC OPERATIONS
The destructor deletes all UMapElem objects in the UMap.
Return the number of mappings in the UMap, corresponding to the number of UMapElems that have been registered.
Delete all the UMapElem mappings in the UMap without destroying the UMap.
UMAP PROTECTED OPERATIONS
UMap() The base class constructor does nothing by default.
Register or remove a UMapElem from the UMap.
UMapElem* Elem(int index)
A UMap stores its UMapElem in its _elems UArray protected member variable. The Index operations returns the index of the given
UMapElem in the UArray, while Elem returns the UMapElem at a specified index. These operations simply perform the corresponding
operations on the UArray.
virtual UMapElem* FindId(void* id)
virtual UMapElem* FindTag(void* tag)
FindId searches the UMap for the UMapElem element containing the given id, while FindTag searches for the one with the given tag.
These operations perform linear searches by default, comparing their arguments against the values that the UMapElems' id and tag
operations return. The comparison is based on the pointer values; subclasses can redefine these operations to make more sophisti-
cated comparisons based on the id or tags actual type. For example, if either the id is a string, then FindId might do a string
comparison to detect a match.
Unidraw 4 October 1990 UMap(3U)