Module: Advanced Tools Package: Serialization
Does not inherit
#include <rw/serial/RWObjectOutputStream.h>
This class consists of a guard object that opens and closes a context within a lexical scope. Simply declare an automatic instance of this class initialized with a object output stream, and all object references within the scope of the automatic variable will be streamed within the same context.
// Output one or more objects in the same context. #include <rw/serial/RWCompactObjectOutputStreamImp.h> #include <rw/serial/RWObjectOutputStream.h> #include <fstream.h> #include <iostream.h> int main() { ofstream fstrm; fstrm.open("RWWithObjectOutputContext.out", ios::out); RWObjectOutputStream out = RWCompactObjectOutputStreamImp::make(fstrm); RWWithObjectOutputContext context(out); int i,j; i = 53; j = 42; out << i << j; return 0; }
RWWithObjectOutputContext(RWObjectOutputStream& strm, bool writeContext = true);
Constructor taking object output stream reference argument. If writeContext is true then write out any document header at the outer context.
RWWithObjectOutputContext(RWObjectOutputStreamImp* strm, bool writeContext = true);
Constructor taking object output stream pointer argument. If writeContext is true then write out in any document header at the outer context.
~RWWithObjectOutputContext();
Destructor automatically closes context.
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.