|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¶
UMAP PUBLIC OPERATIONS¶
UMAP PROTECTED OPERATIONS¶
- The base class constructor does nothing by default.
- void Register(UMapElem*)
- void Unregister(UMapElem*)
- Register or remove a UMapElem from the UMap.
- int Index(UMapElem*)
- 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 sophisticated 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.
|4 October 1990||Unidraw|