Structs or simple classes may be given limited streaming capabilities even though they don't inherit from IMStreamable. To add simple streaming support to a class:
YourClass::operator>>=(IDataStream& toWhere) const; YourClass::operator<<=(IDataStream& fromWhere);In the implementation of these operators, simply invoke the corresponding readFromStream or writeToStream function for the class. You can also put the streaming functionality directly into the streaming operators, but using readFromStream and writeToStream is more consistent with objects provided by Open Class.
Instances of such classes are streamed using the streaming operators only. They may not be streamed using writeObject and readObject, they may not have stream in/out frames for RRDC, and they may not appear in contexts for detection of pointer aliases.
Alternatively, put the streaming functionality directly into global streaming operators, and omit readFromStream() and writeToStream() altogether. This approach is appropriate for classes for which source changes are not possible. It has the disadvantages that the streaming functionality is not bundled with the class being streamed and that the structure of the code is less like that of an IMStreamable class.The alternative global streaming operators have this form:
operator>>=(const YourClass& theObject, IDataStream& toWhere); operator<<=(YourClass& theObject, IDataStream& fromWhere);
Introduction
to the Streaming Classes
Aliased
Objects
Monomorphic
Streaming
Polymorphic
Streaming
Release-to-Release
Data Compatibility (RRDC)
Data Streams
Creating a Streamable
Class
Creating a Streamable
Template Class
Instantiating a Stream
Module
Enabling
Release-to-Release Data Compatibility
Streaming Base Classes
Streaming Aliases
and Aliased Objects
Streaming Objects
Monomorphically
Streaming Objects
Polymorphically