Transitioning from Older Streaming Constructs

The older streaming constructs from VisualAge for C++ 3.5 will remain available on the Windows platforms for compatibility purposes, but are not recommended for new use, and will not be ported to any additional platforms. The old classes will be the only way that data streamed by legacy applications can be read, and should be used only for that purpose.

This table compares the old streaming constructs with the new constructs:

Old streaming construct New streaming construct
obj_ptr2 = ::copyPointer(obj_ptr1)
obj_ptr2 = ::copy(src)
obj_ptr2 = ::copyPointer(obj_ptr1);
obj_ptr2 = ::copy(src)

No Change.

primitiveType <<= aStream
primitiveType >>= aStream
primitiveType <<= aStream
primitiveType >>= aStream

Streaming of primitive types is unchanged.

object_reference >>= aStream
object_reference <<= aStream 
object_reference >>= aStream
object_reference <<= aStream

Monomorphic streaming of embedded objects is unchanged.

Class IFoo
{
    ...
}
class IFoo : public virtual IMStreamable
{
    ...
}

Streamable classes must inherit from IMStreamable.

TypeExtension[*]Macro
StreamableDeclarationsMacro
StreamableDefinitionsMacro

No macros for enabling dynamic cast or copy.

yourClass::operator<<=(IBaseStream&)
yourClass::operator>>=(IBaseStream&)
yourClass::readFromStream(IDataStream&)
yourClass::writeToStream(IDataStream&)

User written streaming functions for a class.

readVersion(aStream)
IStreamInFrame localFrame(aStream);
writeVersion(aStream, version_number)
IStreamOutFrame localFrame(aStream);

Handling of versions is substantially different.

BaseClass::operator>>=(aStream)
BaseClass::operator<<=(aStream) 
BaseClass::writeToStream(aStream);
BaseClass::readFromStream(aStream);

Streaming base classes from within a derived class streaming operator.

:flatten(objectPtr, aStream)
aStream.writeObject(objectPtr);
::resurrect(objectPtr, aStream)
::readObject(objectPtr, aStream);
dynamicCastTo(targ_ptr, src_ptr)
targ_ptr = dynamic_cast<ITargetType*>(src_ptr)

This is standard C++.

createNewObject
Not available.
class IBaseStream
class IDataStream

Subclassing interface is different.
Random access is omitted.
Construction is different.

IBaseStream::SetContext()
IStreamContextFrame(IDataStream&);

Local object to establish a context for top-level users of a stream.



Introduction to the Streaming Classes
Aliased Objects
Monomorphic Streaming
Polymorphic Streaming
Release-to-Release Data Compatibility (RRDC)
Data Streams


Adding Streaming Support to Structs and Simple Classes
Creating a Streamable Class
Creating a Streamable Template Class
Instantiating a Stream Module
Enabling Release-to-Release Data Compatibility
Streaming Base Classes
Instantiating a Data Stream
Streaming Aliases and Aliased Objects
Streaming Objects Monomorphically
Streaming Objects Polymorphically