Class name ambiguity becomes an issue with polymorphic streaming (::writeObject() and ::readObject()). WriteToStream() puts a representation of the class type on the stream in addition to the class data, and readFromStream picks up the class name and instantiates an object of that type which then receives data from the stream.
For example:
// // Declare a streamable class, probably in a header file // class myClass: public virtual IMStreamable { ... }
// // Implementation for the above class, in a .cpp file. //
// the stream module into which myClass will be scoped. IStreamModule gMyStreamModule("my_product_name_and_my_company_name");
// associate myClass with this stream module StreamableDefinitionsMacro(myClass, gMyStreamModule);
// implementation of the member functions of myClass... myClass::myClass() {
Do not derive from this class.
This class is not thread aware.
Constructors & DestructorThe constructor and destructor for this class.
![]() |
public:
virtual ~IStreamModule()
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |
![]() |
public:
IStreamModule(const char* moduleName)
Choose the name such that other developers will not inadvertantly pick the same one.
| Windows | OS/2 | AIX |
| Yes | Yes | Yes |