SourcePro® C++ API Reference Guide

Product Documentation:
   SourcePro C++
Documentation Home
List of all members | Public Member Functions
RWWithObjectOutputContext Class Reference

Represents a guard object that opens and closes a context within a lexical scope for output streams. More...

#include <rw/serial/RWObjectOutputStream.h>

Public Member Functions

 RWWithObjectOutputContext (RWObjectOutputStream &strm, bool writeContext=true)
 
 RWWithObjectOutputContext (RWObjectOutputStreamImp *strm, bool writeContext=true)
 
 ~RWWithObjectOutputContext ()
 

Detailed Description

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.

Example
// 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);
int i,j;
i = 53;
j = 42;
out << i << j;
return 0;
}
See also
RWObjectOutputStream

Constructor & Destructor Documentation

RWWithObjectOutputContext::RWWithObjectOutputContext ( RWObjectOutputStream strm,
bool  writeContext = true 
)
inline

Constructor taking an object output stream reference argument. If writeContext is true, then write out any document header at the outer context.

RWWithObjectOutputContext::RWWithObjectOutputContext ( RWObjectOutputStreamImp strm,
bool  writeContext = true 
)
inline

Constructor taking an object output stream pointer argument. If writeContext is true, then write out in any document header at the outer context.

RWWithObjectOutputContext::~RWWithObjectOutputContext ( )
inline

Destructor automatically closes the context.

Copyright © 2016 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.
Provide feedback to Rogue Wave about its documentation.