Instantiating a Stream Module

Typically, you will instantiate one instance of IStreamModule per .DLL or .EXE. Instances of IStreamModule are used to uniquely identify types on a stream.

You must declare all stream modules as global variables. Do not declare them static because they will not be visible to functions in other files.

IStreamModule gMyDataStreamModule("MyDataStreamModule");

In the source file for each of your streamable classes, make sure to associate your class with the stream module. The second parameter of the StreamableDeclarationsMacro expects the name of the module variable, not the module name string:

// In source file for IChangeLanguageCommand
extern IStreamModule gMyDataStreamModule;

StreamableDefinitionsMacro(IChangeLanguageCommand, gMyDataStreamModule);

You can also declare the IStreamModule in one of your header files so that you don't have to declare the IStreamModule as "extern" in every implementation file that uses it.



Introduction to the Streaming Classes
Data Streams


Creating a Streamable Class
Creating a Streamable Template Class
Instantiating a Data Stream
Streaming Aliases and Aliased Objects
Streaming Objects Polymorphically