beautypg.com

Recap – HP Integrity NonStop J-Series User Manual

Page 84

background image

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

©Copyright 1996 Rogue Wave Software

Recap

In this section, you have seen how an object can be stored to and recovered from a stream
without regard for the final destination of the bytes of that stream, whether memory or disk.
You have also seen that you need not be concerned with the final formatting of the stream,
whether ASCII or binary.

You can also write your own specializing virtual stream class, much like

RWpostream

and

RWpistream

. The great advantage of the virtual streams facility is that, if you do write your own

specialized virtual stream, you don't have to modify any of the code of the client classes_you
just use your stream class as an argument to:

RWvostream& operator<<(RWvostream&, const ClassName&);
RWvistream& operator>>(RWvistream&, ClassName&);

In addition to storing and retrieving an object to and from virtual streams, all of the classes can
store and retrieve themselves in binary to and from an

RWFile

. This file encapsulates ANSI-C

style file I/O. Although more limited in its abilities than stream I/O, this form of storage and
retrieval is slightly faster to and from disk because the virtual dispatching machinery is not
needed.

This manual is related to the following products: