Click on the banner to return to the Class Reference home page.

©Copyright 1996 Rogue Wave Software

RWCollection


RWCollectionRWCollectable

Synopsis

#include <rw/colclass.h>
typedef RWCollection Collection;   // Smalltalk typedef

Description

Class RWCollection is an abstract base class for the Smalltalk-like collection classes. The class contains virtual functions for inserting and retrieving pointers to RWCollectable objects into the collection classes. Virtual functions are also provided for storing and reading the collections to files and streams. Collections that inherit this base class will typically redefine one or more of these functions.

In the documentation below, pure virtual functions are indicated by "= 0" in their declaration. These functions must be defined in derived classes. For these functions the description is intended to be generic -- all inheriting collection classes generally follow the described pattern. Exceptions are noted in the documentation for the particular class.

For many other functions, a suitable definition is provided by RWCollection and a deriving class may not need to redefine the function. Examples are contains() or restoreGuts().

Persistence

Polymorphic

Public Member Operators

void
operator+=(const RWCollection&);
void
operator-=(const RWCollection&);

Public Member Functions

virtual
~RWCollection();
virtual void
apply(RWapplyCollectable ap, void*) = 0;
RWBag
asBag() const;
RWSet
asSet() const;
RWOrdered
asOrderedCollection() const;
RWBinaryTree
asSortedCollection() const;
virtual RWspace
binaryStoreSize() const;
virtual void
clear() = 0;
virtual void
clearAndDestroy();
virtual int
compareTo(const RWCollectable* a) const;
virtual RWBoolean
contains(const RWCollectable* target) const;
virtual size_t
entries() const = 0;
virtual RWCollectable*
find(const RWCollectable* target) const = 0;
virtual unsigned
hash() const;
virtual RWCollectable*
insert(RWCollectable* e) = 0;
virtual RWClassID
isA() const;
virtual RWBoolean
isEmpty() const = 0;
virtual RWBoolean
isEqual(const RWCollectable* a) const;
virtual size_t
occurrencesOf(const RWCollectable* t) const = 0;
virtual void
restoreGuts(RWFile&);
virtual void
restoreGuts(RWvistream&);
RWCollectable*
remove(const RWCollectable* target) = 0;
virtual void
removeAndDestroy(const RWCollectable* target);
RWCollection*
select(RWtestCollectable tst, void* x) const;
virtual void
saveGuts(RWFile&);
virtual void
saveGuts(RWvostream&);