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.
The constructors and destructors for the IMStreamable class.
![]() |
public:
virtual ~IMStreamable()
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
protected:
IMStreamable(const IMStreamable& other)
Windows | OS/2 | AIX |
Yes | Yes | Yes |
protected:
IMStreamable()
Windows | OS/2 | AIX |
Yes | Yes | Yes |
These methods are used by the streaming implementation classes. User code should neither override them or call them directly.
![]() |
public:
void externalizeToStream(IDataStream& towhere) const
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
void internalizeFromStream(IDataStream& fromwhere)
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
public:
virtual const ITypeRepresentation& typeRepresentation() const = 0
Windows | OS/2 | AIX |
Yes | Yes | Yes |
These are the functions used to write and read data to and from streams.
![]() |
protected:
virtual void readFromStream(IDataStream& fromwhere) = 0
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.
Windows | OS/2 | AIX |
Yes | Yes | Yes |
![]() |
protected:
virtual void writeToStream(IDataStream& towhere) const = 0
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.
Windows | OS/2 | AIX |
Yes | Yes | Yes |