Streaming operations

Streams can be read or written in two ways: monomorphically and polymorphically. A monomorphic stream implies elements of a single type. A polymorphic stream contains mixed element types, usually with a shared ancestor class that defines common protocol.

Monomorphic streaming functions (>>= and <<=) are defined in every CommonPoint class, unless they are absolutely not needed. These are the most efficient read and write operations for streams. The >>= and <<= functions, which are global overloaded operators, are basically wrappers around the Write and Read functions. You do not need to inherit from MCollectible if you are only using the >>= and <<= functions.

Polymorphic streaming operators (Flatten and Resurrect) are more expensive functions because they do more work and preserve more information. If you want to use the Flatten function, you must inherit from MCollectible.

This section describes the monomorphic, polymorphic, and other important streaming operations.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker