Represents a guard object that opens and closes a context within a lexical scope for output streams.
More...
#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.
- Example
#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;
}
static RWObjectOutputStream make(const RWDataOutputStream &sink, bool annotateStream=false)
Handle class for all the object output stream implementation classes.
Definition RWObjectOutputStream.h:41
Represents a guard object that opens and closes a context within a lexical scope for output streams.
Definition RWObjectOutputStream.h:491
- See also
- RWObjectOutputStream
◆ RWWithObjectOutputContext() [1/2]
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() [2/2]
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::~RWWithObjectOutputContext |
( |
| ) |
|
|
inline |
Destructor automatically closes the context.