WWC snapshot of http://www.alw.nih.gov/Docs/NIHCL/nihcl_17.html taken on Sat Jun 10 19:13:42 1995

Go to the previous, next section.

IdentSet--Set Keyed by Object Address

SYNOPSIS

#include <nihcl/IdentSet.h>

BASE CLASS

Set

DERIVED CLASSES

None

RELATED CLASSES

Iterator

DESCRIPTION

An IdentSet (Identity Set) is similar to a Set, except that it uses isSame() for determining if an object already belongs to a Set. Instances of class IdentSet are useful in suppressing undesired multiple applications of member functions to class instances used as virtual base classes. For example, the storeOn() and deepCopy() operations use IdentSets to prevent the members of a virtual base class from being stored or deepened, respectively, more than once.

CONSTRUCTORS

IdentSet(unsigned capacity =DEFAULT_CAPACITY)
Constructs an empty IdentSet that can hold up to capacity objects. An NIHCL_ALLOCSIZE error is raised if capacity is not greater than 0. If an attempt is made to add more than capacity objects to an IdentSet, reSize() is called to increase its capacity. Since this is an expensive operation, it is wise to supply a reasonable estimate for capacity.

PROTECTED MEMBERS

Hashing and Searching

virtual int findIndexOf(const Object& ob) const
Searches this IdentSet for an object that is isSame() as ob and returns the index of this object, if found, or the index of an empty slot (a slot containing a nil pointer) in the hash table where ob should be inserted.

virtual unsigned hashOf(const Object& ob) const
Computes a number suitable for use as a hash table probe by returning the address of ob.

EXCEPTIONS RAISED

None

Go to the previous, next section.