RRDC allows a user class to stream out its instance data in such a way that either newer or older versions of the class will be able to succsessfully read the data.
For any application class that supports RRDC, the override of IMStreamable::writeToStream() must declare a local instance of IStreamOutFrame before streaming out the member data of the class. The scope of this local variable must enclose all of the stream-outs of the member data.
The effect of the the presence of an IStreamOutFrame on the IDataStream is to delimit, or frame, the data that is written to the stream. This allows the reader of the stream to determine whether the stream has too little data (old writer, new reader), the right amount of data (compatible reader and writer), or too much data (new writer, old reader). In the case of too much data, the frame provides the information needed to automatically skip over the extra data.
Use of stream frames is required in classes, even in their first release, if RRDC may be required for subsequent releases.
Example
// // An example of a class and writeToStream function. // RRDC with other versions of the class is allowed // for through the use of IStreamOutFrame. // class myClass: public IMStreamable { ... int fData1; someType fData2; ... };
void myClass:writeToStream(IDataStream &toWhere) { IStreamOutFrame frame(toWhere); fData1 >>= toWhere; fData2 >>= toWhere; };
Constructors & DestructorThe constructor and destructor for this class.
![]() |
public:
~IStreamOutFrame()
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
IStreamOutFrame(IDataStream& aStream)
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |