InterViews Reference Manual -- Table
NAME
Table - associative store for object pointers
SYNOPSIS
#include <InterViews/table.h>
DESCRIPTION
A table is an index where the key and data are pointers of unspecified type,
declared as are void*.
PUBLIC OPERATIONS
Table(int size)
Construct a table of the given size. The size will be rounded up to the next
power of two so that indexing the table does not require division (just take
the bitwise-and of the key and (size-1)).
~Table()
Free storage associated with the table.
void Insert(void* key, void* value)
Add (key, value) pair to the table. Insert does not prevent
a key from being entered in the table more than once.
bool Find(void*& value, void* key)
If key has been inserted into the table, set value to the
associated value and return true. Otherwise, do not modify value and
return false. In the presence of duplicate keys, Find gets the most recently
inserted value.
void Remove(void* key)
Delete key from the table. If key appears in the table more
than once, the most recently inserted entry is removed.
Next: TextBuffer
| Prev: Subject
| Up: index
| Top: index