Provide a class identifier for your class, See below, Rwdeclare – HP Integrity NonStop J-Series User Manual
Page 218: Only one source file (.cpp), to be compiled, Provide a class ident

Default constructors are necessary in order to create vectors of objects in C++, so providing a
default constructor is a good habit to get into anyway. Here's a possible definition of a default
constructor for our Bus class.
Bus::Bus() :
busNumber_ (0),
driver_ ("Unknown"),
passengers_ (rwnil)
{
}
Add RWDECLARE_COLLECTABLE() to your Class Declaration
The example earlier in this chapter (
An Example of RWCollectable Classes
) includes the macro
invocation RWDECLARE_COLLECTABLE(Bus) in the declaration for Bus. You must put this
macro in your class declaration, using the class name as the argument. Using the macro guarantees
that all necessary member functions are declared correctly.
Provide a Class Identifier for Your Class
Polymorphic persistence lets you save a class in one executable, and restore it in a different
executable or in a different run of the original executable. The restoring executable can use the
class, without prior knowledge of its type. In order to provide polymorphic persistence, a class
must have a unique,
[22]
unchanging identifier. Because classes derived from
RWCollectable
are
polymorphically persistent, they must have such an identifier.
Identifiers can be either numbers or strings. A numeric identifier is an unsigned short with a
typedef of RWClassID. A string identifier has a typedef of RWStringID. If you choose to specify a
numeric identifier, your class will have an automatically generated string identifier, which will be
the same sequence of characters as the name of the class. Similarly, if you choose to specify a
string identifier, your class will have an automatically generated numeric ID when used in an
executable.
Tools.h++ includes two definition macros to provide an identifier for the class you design. If you
want to specify a numeric ID, use:
RWDEFINE_COLLECTABLE (className, numericID)
If you want to specify a string ID, use:
RWDEFINE_NAMED_COLLECTABLE (className, stringID)
Note that you do not include the definition macros in the header file for the class. Rather, the
macros are part of a .cpp file that uses the class. You must include exactly one define macro for
each
RWCollectable
class that you're creating, in one and only source file (.cpp). Use the class
name as the first argument, and a numeric class ID or string class ID as the second argument. For
the bus example, you can include the following definition macros:
RWDEFINE_COLLECTABLE(Bus, 200)