Rogue Wave Software logo banner

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

©Copyright 1996 Rogue Wave Software

RWSet


RWSetinherits fromRWHashTableinherits fromRWCollectioninherits fromRWCollectable

Synopsis

typedef RWSet Set;   // Smalltalk typedef.
#include <rw/rwset.h>

RWSet h;

Description

Class RWSet represents a group of unordered elements, not accessible by an external key, where duplicates are not allowed. It corresponds to the Smalltalk class Set.

An object stored by RWSet must inherit abstract base class RWCollectable, with suitable definition for virtual functions hash() and isEqual() (see class RWCollectable). The function hash() is used to find objects with the same hash value, then isEqual() is used to confirm the match.

An item c is considered to be "already in the collection" if there is a member of the collection with the same has value as c for which isEqual(c) returns TRUE. In this case, method insert(c) will not add it, thus insuring that there are no duplicates.

The iterator for this class is RWSetIterator.

Persistence

Polymorphic

Public Constructors

RWSet (size_t n = RWDEFAULT_CAPACITY);
RWSet (const RWSet & h);
virtual ~RWSet();

Public Member Operators

void
operator=(const RWSet& h);
RWBoolean
operator==(const RWSet& h);
RWBoolean
operator!=(const RWSet& h);
RWBoolean
operator<=(const RWSet& h);
RWBoolean
operator<(const RWSet& h);
RWSet&
operator*=(const RWSet& h);

Public Member Functions

virtual void
apply(RWapplyCollectable ap, void*);
virtual RWspace
binaryStoreSize() const;
virtual void
clear();
virtual void
clearAndDestroy();
virtual int
compareTo(const RWCollectable* a) const;
virtual RWBoolean
contains(const RWCollectable* target) const;
virtual size_t
entries() const;
virtual RWCollectable*
find(const RWCollectable* target) const;
virtual unsigned
hash() const;
virtual RWCollectable*
insert(RWCollectable* c);
virtual RWClassID
isA() const;
virtual RWBoolean
isEmpty() const;
virtual RWBoolean
isEqual(const RWCollectable* a) const;
void
intersectWith(const RWSet& h, RWSet& ret) const;
virtual size_t
occurrencesOf(const RWCollectable* target) const;
virtual RWCollectable*
remove(const RWCollectable* target);
virtual void
removeAndDestroy(const RWCollectable* target);
void
resize(size_t n = 0);
virtual void
restoreGuts(RWvistream&);
virtual void
restoreGuts(RWFile&);
virtual void
saveGuts(RWvostream&) const;
virtual void
saveGuts(RWFile&) const;
RWStringID
stringID();