IMStreamable

The root class of all streamable classes. IMStreamable is a common base class for streamable classes.

For further information on streaming, see the descriptions of classes IDataStream, IStreamModule, IStreamContextFrame, IStreamInFrame and IStreamOutFrame.

Its use is required for streamable classes that support polymorphic streaming and/or release-to-release data compatibility.

"Polymorphic streaming" means that the application defined objects will be used with the ::readObject() and ::writeObject() functions, that the object to be read or written will be specified by a reference, and that the actual object type may be any derived type of the specified reference type.

Release-to-release data compatibility is the ability for a class to interpret stream data that was written either by older or newer versions of the class. For more details on RRDC, see classes IStreamInFrame and IStreamOutFrame.

Simple classes (or structs, or primitives) that do not need these advanced capabilities may be streamed even though they do not derive from IMStreamable..

This is an abstract mixin class.

All non-abstract classes deriving from IMStreamable must incude the StreamableDeclarations and StreamableDefinitions macros.

Example of Usage:

//
//  Class decaration, typically in a header file.
//
class MyApplicationClass: public virtual IMStreamable {
public:
   ...
   StreamableDeclarationsMacro(MyApplicationClass);

protected: virtual void writeToStream(IDataStream &toWhere) const; virtual void readFromStream(IDataStream &fromWhere);

private: ... };

// // These go in the implementation (.cpp) file for the class. // IStreamModule myStreamModule("a_name_unique_to_my_app"); StreamableDefinitionsMacro(MyApplicationClass, myStreamModule);

Do not derive your own classes from this class.


IMStreamable - Member Functions and Data by Group

Constructors & Destructor

The constructors and destructors for the IMStreamable class.


[view class]
~IMStreamable
public:
virtual ~IMStreamable()
Destructor

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
IMStreamable
Constructors


Overload 1
protected:
IMStreamable(const IMStreamable& other)
Copy constructor. Will be implicitly called by the copy constructor for classes deriving from IMStreamable. Stand-alone instances of IMStreamable can not exist, and thus can not be copied; IMStreamable can only exist as a base class of other derived classes.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
protected:
IMStreamable()
Default constructor. Will be implicitly called by classes deriving from IMStreamable. Stand-alone instances of IMStreamable can not be constructed; they can only exist as a base class of other derived classes.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Implementation Functions

These methods are used by the streaming implementation classes. User code should neither override them or call them directly.


[view class]
externalizeToStream
public:
void externalizeToStream(IDataStream& towhere) const
This method is used by the global streaming opertors and IStreamIO implementation classes. User code should neither override this function or call it directly.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
internalizeFromStream
public:
void internalizeFromStream(IDataStream& fromwhere)
This method is used by the global streaming opertors and IStreamIO implementation classes. User code should neither override this function or call it directly.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
typeRepresentation
Get the dynamic type representation.
public:
virtual const ITypeRepresentation& typeRepresentation() const = 0
This function is declared and implemented by the Streamable macros, and is part of the implementation of the streaming. This function should not be called directly by application code, nor should it be explicitly overridden.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Streaming Interface

These are the functions used to write and read data to and from streams.


[view class]
readFromStream
protected:
virtual void readFromStream(IDataStream& fromwhere) = 0
All subclasses of IMStreamable must override this function.

The override reads the state of this object - instance variables and base classes - from the IDataStream. Instance variables are read using the <<= operator or ::readObject() functions; base classes are read by calling the inherited readFromStream function.

The streaming implementation will call this function in response to user code invoking either the <<= operator or a ::readObject function on an instance of the class.

The writeToStream() function must write the data to the stream in the same order in which it will be read by this function.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
writeToStream
protected:
virtual void writeToStream(IDataStream& towhere) const = 0
All subclasses of IMStreamable must override this function.

The override writes the state of the object - instance variables and base classes - to the IDataStream. Instance variables are written using the >>= operator or ::writeObject() functions; base classes are written by calling the inherited writeToStream function.

The streaming implementation will call this function in response to user code invoking either the >>= operator or a ::writeObject function on an instance of the class.

The readFromStream() function must read the data from the stream in the same order in which it was written by this function.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


IMStreamable - Inherited Member Functions and Data

Inherited Public Functions

Inherited Public Data

Inherited Protected Functions

Inherited Protected Data