How to create an rwcollectable object, Define a default constructor – HP Integrity NonStop J-Series User Manual
Page 217

Click on the banner to return to the user guide home page.
©Copyright 1996 Rogue Wave Software
How to Create an RWCollectable Object
Here's an outline of how to make your object inherit from
RWCollectable
. Additional information
about how to do each step appears in the indicated section.
1.
Add the macro RWDECLARE_COLLECTABLE to your class declaration.
.
2.
Provide a class identifier for your class by adding one of two definition macros,
RWDEFINE_COLLECTABLE or RWDEFINE_NAMED_COLLECTABLE, to one and
only one source file (.cpp), to be compiled.
3.
Add definitions for inherited virtual functions as necessary. You may be able to use inherited
definitions. The following virtual functions are dicussed
Int compareTo(const RWCollectable*) const;
RWBoolean isEqual(const RWCollectable*) const;
unsigned hash() const;
4.
Consider whether you need to define a destructor.
.
5.
Add persistence to the class. You may be able to use inherited definitions, or you may have
to add definitions for the following functions.
.
RWspace binaryStoreSize() const;
void restoreGuts(RWFile&);
void restoreGuts(RWvistream&);
void saveGuts(RWFile&) const;
void saveGuts(RWvostream&) const;
6.
A note on
RWFactory
follows these steps.
Define a Default Constructor
All
RWCollectable
classes must have a default constructor. The default constructor takes no
arguments. The persistence mechanism uses this constructor to create an empty object, then restore
that object with appropriate contents.