Tools.h++ Manual

104011 Tandem Computers Incorporated 21-53
21
Note – The meaning of "is equal to", "larger" and "smaller" is left to the user.
The default definition provided by the base class is based on the addresses, i.e.,
return this == p2 ? 0 : (this p2 ? 1 : -1);
and is probably not very useful.
virtual unsigned hash() const;
Returns a hash value. This function is necessary for collection classes that use
hash table look-up. The default definition provided by the base class hashes
the object's address:
return (unsigned)this;
virtual RWClassID isA() const;
Returns a class identification number (typedef'd to be an
unsigned short
).
The default definition returns
__RWCOLLECTABLE
. Identification numbers
greater than or equal to 0x8000 (hex) are reserved for Tools.h++ objects. User
defined classes should define
isA()
to return a number between 0 and 0x7FFF.
virtual RWBoolean isEqual(const RWCollectable* t)
const;
Returns
TRUE
if collectable object "matches" object at address
t
. The default
definition is:
return this == t;
i.e., both objects have the same address (a test for identity). The definition may
be redefined in any consistent way.
virtual RWCollectable* newSpecies() const;
Allocates a new object off the heap of the same type as self and returns a
pointer to it. You are responsible for deleting the object when done with it.
virtual void restoreGuts(RWFile&);
Read an object's state from a binary file, using class
RWFile
, replacing the
previous state.
virtual void restoreGuts(RWvistream&);
Read an object's state from an input stream, replacing the previous state.
virtual void saveGuts(RWFile&) const;
Write an object's state to a binary file, using class
RWFile
.