Tools.h++ Manual

104011 Tandem Computers Incorporated 16-1
Persistence 16
All of the examples of persistence that we have looked at so far involve simple
objects that do not reference other objects. It is time to look at some more
complicated cases.
16.1 Operators
The storage and retrieval of objects that inherit from
RWCollectable
is a
powerful and adaptable feature of the Tools.h++ Class Library. It is done
through the following eight functions:
// Storage of a RWCollectable reference:
RWvostream& operator<<(RWvostream&, const RWCollectable&); // 1
RWFile& operator<<(RWFile&, const RWCollectable&); // 2
// Storage of a RWCollectable pointer:
RWvostream& operator<<(RWvostream&, const RWCollectable*); // 3
RWFile& operator<<(RWFile&, const RWCollectable*); // 4
// Retrieval into an existing RWCollectable:
RWvistream& operator>>(RWvistream&, RWCollectable&); // 5
RWFile& operator>>(RWFile&, RWCollectable&); // 6
//Retrieval into an RWCollectable to be allocated off the heap:
RWvistream& operator>>(RWvistream&, RWCollectable*&); // 7
RWFile& operator>>(RWFile&, RWCollectable*&); // 8