Tools.h++ Manual
21-52 104011 Tandem Computers Incorporated
21
RWCollectable
Synopsis
typedef RWCollectable Object; // Smalltalk typedef
#include <rw/collect.h>
Description Class
RWCollectable
is an abstract base class for collectable objects. This
class contains virtual functions for identifying, hashing, comparing, storing
and retrieving collectable objects. While these virtual functions have simple
default definitions, objects that inherit this base class will typically redefine one
or more of them.
Virtual functions
virtual ~RWCollectable()
All functions that inherit class
RWCollectable
have virtual destructors. This
allows them to be deleted by such member functions as
removeAndDestroy()
without knowing their type.
virtual RWspace binaryStoreSize() const;
Returns the number of bytes used by the virtual function
saveGuts
(RWFile&)
to store an object. Typically, this involves adding up the space
required to store all primitives, plus the results of calling
recursiveStoreSize()
for all objects inheriting from
RWCollectable
. See
Chapter 16, “Persistence” for details.
virtual int compareTo(const RWCollectable*)
const;
The function
compareTo()
is necessary to sort the items in a collection. If
p1
and
p2
are pointers to
RWCollectable
objects, the statement
p1-compareTo(p2);
should return:
0 if *p1 "is equal to" *p2;
>0 if *p1 is "larger" than *p2;
<0 if *p1 is "smaller" than *p2.