Tools.h++ Manual
104011 Tandem Computers Incorporated 21-65
21
Public member functions
virtual ~RWCollection();
Null definition (does nothing).
virtual void apply(RWapplyCollectable ap,
void*) = 0;
This function applies the user-supplied function pointed to by ap to each
member of the collection. This function should have prototype
void
yourApplyFunction
(RWCollectable* c, void*);
The function yourApplyFunction() can perform any operation on the item at
address
c
that does not change the ordering of the collection. Client data may be
passed to this function by using the second argument.
RWBag asBag() const;
RWSet asSet() const;
RWOrdered asOrderedCollection() const;
RWBinaryTree asSortedCollection() const
Allows any collection to be converted to a
RWBag
,
RWSet
,
RWOrdered
, or a
RWBinaryTree
.
virtual RWspace binaryStoreSize() const;
Redefined from class
RWCollectable
.
virtual void clear() = 0;
Removes all objects from the collection. Does not delete the objects
themselves.
virtual void clearAndDestroy();
Removes all objects from the collection and deletes them. Takes into account
duplicate objects within a collection and only deletes them once. However, it
does not take into account objects shared between different collections. Either
do not use this function if you will be sharing objects between separate
collections, or put all collections that could be sharing objects into one single
"super-collection" and call
clearAndDestroy()
on that.
virtual int compareTo(const RWCollectable*
a) const;
Inherited from class
RWCollectable
.
virtual RWBoolean contains(const RWCollectable*
target) const;
Returns
TRUE
if the collection contains an item where the virtual function
find()
returns non-nil.