beautypg.com

Chapter 15: designing an rwcollectable class – HP Integrity NonStop J-Series User Manual

Page 212

background image

Click on the banner to return to the user guide home page.

©Copyright 1996 Rogue Wave Software

Chapter 15: Designing an
RWCollectable Class

Why Design an RWCollectable Class?

An Example of RWCollectable Classes

How to Create an RWCollectable Object

Define a Default Constructor

Add RWDECLARE_COLLECTABLE() to your Class Declaration

Provide a Class Identifier for Your Class

Add Definitions for Virtual Functions

Object Destruction

How to Add Polymorphic Persistence

A Note on the RWFactory

Summary

Classes that derive from

RWCollectable

carry two major advantages: they can be used by the

Smalltalk-like collections, which also derive from RWCollectable, and they are the only set of
collection classes able to use the powerful polymorphic persistence machinery. In this section,
we will provide some examples of RWCollectable classes, then describe how to create your
own RWCollectable classes.

What we don't do in this section is describe the mechanism of polymorphic persistence itself.
Polymorphic, isomorphic, and simple persistence are all covered in detail in the previous
chapter called Persistence. To summarize, polymorphic persistence is the storage and retrieval
of objects to and from a stream or file in such a way that pointer relationships are preserved
among persisted objects, which can be restored without the restoring process knowing the
object's type.

This manual is related to the following products: