We describe the design and implementation of ObjectStream, a system for automatic generation of stream I/O primitives for complex C++ objects. The system consists of a parser based program generator and a generic object I/O library. The program generator pre-processes C++ class declarations to produce class-specific routines that, when executed with application programs, assists the class-neutral generic library to perform I/O operations for objects of the pre-processed classes. ObjectStream is novel in that it is non intrusive. It lets programmers keep the original class declarations for application development, without requiring the classes to be modified for I/O or to be derived from a persistent base class. This makes easy the task of managing application source code, and ensures compatibility of objects produced with and without the added I/O capability. The implementation of ObjectStream is compiler and machine independent, and its operation requires little guidance from the programmers. We describe the motivations behind ObjectStream, our development strategies, and several interesting implementation issues. A working example is included to illustrate the ObjectStream system.
['Tyng-Ruey Chuang', 'Chuan-Chieh Jung', 'Wen-Min Kuan', 'Y.S. Kuo']
ObjectStream: generating stream-based object I/O for C++