rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWCompactObjectOutputStreamImp Class Reference
[Serialization]

Writes objects in a compact format to the supplied RWDataOutputStream. More...

#include <rw/serial/RWCompactObjectOutputStreamImp.h>

Inheritance diagram for RWCompactObjectOutputStreamImp:
RWObjectOutputStreamImp RWFilteredDataOutputStreamImp RWDataOutputStreamImp RWOutputStreamImp RWStreamImp RWBodyBase RWTCountingBody< RWMutexLock > RWTMonitor< RWMutexLock >

List of all members.

Public Member Functions

virtual void startBlock (const RWSymbol &)
virtual void endBlock ()
virtual bool needToWrite (const void *obj)
virtual void writeNullPtr ()
virtual void newObjectMarker ()
virtual void writeTypeInfo (const RWSymbol &typeInfo)
virtual void rememberObject (const void *obj)
virtual void writeMemberInfo (const RWSymbol &memberName, RWStreamType memberType)
virtual void startSequence (int count, RWStreamType elementType, const RWSymbol &)
virtual void startMap (int count, RWStreamType keyType, RWStreamType valueType, const RWSymbol &)
virtual void putString (const RWCString &str)
virtual void putWString (const RWWString &str)
virtual void putUString (const RWBasicUString &str)
virtual void setNameForNextObject (const RWCString &)

Static Public Member Functions

static RWObjectOutputStream make (const RWDataOutputStream &sink, bool annotateStream=false)

Protected Member Functions

virtual void openOuterContext (bool writeContext)
virtual void closeOuterContext (bool writeContext)
 RWCompactObjectOutputStreamImp (const RWDataOutputStream &sinkStream, bool annotateStream)
virtual void putString (const char *string, RWSize count)
virtual void putWString (const wchar_t *wstring, RWSize count)
virtual void putUString (const RWUChar *ustring, RWSize count)

Detailed Description

The class RWCompactObjectOutputStreamImp writes objects in a compact format to the supplied RWDataOutputStream. The format of this stream resembles that produced when RWCollectable instances are persisted using RW virtual streams. Implements the body idiom from the handle/body pattern. The stream can optionally be annotated with member (attribute) name and type information to support generic parsing.

Examples

 // Create a strstream to serve as our sink
 ostrstream s;
 
 // Create a compact data stream using the strstream
 RWObjectOutputStream in = RWCompactObjectOutputStreamImp::make(
                           RWDataToVirtualOutputStream(s));
 
 // Write integer value 1  to compact data stream
 s << 1;

Constructor & Destructor Documentation

RWCompactObjectOutputStreamImp::RWCompactObjectOutputStreamImp ( const RWDataOutputStream sinkStream,
bool  annotateStream 
) [inline, protected]

Used by derived classes to initialize the next processing stream. Throws no exceptions.

Parameters:
sinkStream is a handle to the next processing stream.
annotateStream indicates whether or not the stream will be annotated.

Member Function Documentation

virtual void RWCompactObjectOutputStreamImp::closeOuterContext ( bool  writeContext  )  [protected, virtual]

Really closes an open context. This function is called when the number of closeContext() calls matches the number of openContext() calls.

Implements RWObjectOutputStreamImp.

virtual void RWCompactObjectOutputStreamImp::endBlock (  )  [virtual]

Causes tokens to be output that identify the end of an object.

Implements RWObjectOutputStreamImp.

static RWObjectOutputStream RWCompactObjectOutputStreamImp::make ( const RWDataOutputStream sink,
bool  annotateStream = false 
) [static]

Constructs an RWCompactObjectOutputStreamImp instance that uses the parameter sink as its sink of bytes, and returns a handle to it. Throws no exceptions.

Parameters:
sink is the data stream that is used as the sink of bytes.
annotateStream indicates whether or not the stream will be annotated.
virtual bool RWCompactObjectOutputStreamImp::needToWrite ( const void *  obj  )  [virtual]

Returns true when the referenced object has not yet been written to the stream in the current context. Otherwise, tokens are output identifying this object as a previously streamed one, and the function returns false.

Implements RWObjectOutputStreamImp.

virtual void RWCompactObjectOutputStreamImp::newObjectMarker (  )  [virtual]

Output is a token indicating that an object will be created by the factory.

Implements RWObjectOutputStreamImp.

virtual void RWCompactObjectOutputStreamImp::openOuterContext ( bool  writeContext  )  [protected, virtual]

Really opens a new context. This function is called by openContext() when a context is not already open.

Implements RWObjectOutputStreamImp.

virtual void RWCompactObjectOutputStreamImp::putString ( const char *  string,
RWSize  count 
) [inline, protected, virtual]

Forwards the writing of a narrow character string, including embedded nulls, starting at string to the next processing stream.

Parameters:
string A pointer to the narrow string's first character.
count The number of narrow character(s) to be written to the stream.

Reimplemented from RWObjectOutputStreamImp.

virtual void RWCompactObjectOutputStreamImp::putString ( const RWCString str  )  [virtual]

Writes an RWCString to the stream.

Implements RWObjectOutputStreamImp.

virtual void RWCompactObjectOutputStreamImp::putUString ( const RWUChar ustring,
RWSize  count 
) [inline, protected, virtual]

Forwards the writing of a UTF-16 character string, including embedded nulls, starting at ustring to the next processing stream.

Parameters:
ustring A pointer to the string's first unicode character.
count The number of unicode character(s) to be written to the stream.

Reimplemented from RWObjectOutputStreamImp.

virtual void RWCompactObjectOutputStreamImp::putUString ( const RWBasicUString str  )  [virtual]

Writes an RWBasicUString to the stream.

Implements RWObjectOutputStreamImp.

virtual void RWCompactObjectOutputStreamImp::putWString ( const wchar_t *  wstring,
RWSize  count 
) [inline, protected, virtual]

Forwards the writing of a wide character string, including embedded nulls, starting at wstring to the next processing stream.

Parameters:
wstring A pointer to the string's first wide character.
count The number of wide character(s) to be written to the stream.

Reimplemented from RWObjectOutputStreamImp.

virtual void RWCompactObjectOutputStreamImp::putWString ( const RWWString str  )  [virtual]

Writes an RWWString to the stream.

Implements RWObjectOutputStreamImp.

virtual void RWCompactObjectOutputStreamImp::rememberObject ( const void *  obj  )  [virtual]

Called by streaming operators to record each instance streamed out, in case it is referenced again in the same context.

Parameters:
obj Holds the address of the instance.

Implements RWObjectOutputStreamImp.

virtual void RWCompactObjectOutputStreamImp::setNameForNextObject ( const RWCString str  )  [inline, virtual]

Sets up the instance name for the next object to be written out.

Implements RWObjectOutputStreamImp.

virtual void RWCompactObjectOutputStreamImp::startBlock ( const RWSymbol typeInfo  )  [virtual]

Causes tokens to be output that identify the start of a new object.

Parameters:
typeInfo Identifies the type of the new object, if such information is available.

Implements RWObjectOutputStreamImp.

virtual void RWCompactObjectOutputStreamImp::startMap ( int  count,
RWStreamType  keyType,
RWStreamType  valueType,
const RWSymbol typeInfo 
) [virtual]

Called by the output operators for association types (hash tables, etc.) at the start.

Parameters:
count Contains the number of items in the association.
keyType Contains the type of key in the association.
valueType Contains the type of value in the association.
typeInfo Contains the type of the association(collection) itself

Implements RWObjectOutputStreamImp.

virtual void RWCompactObjectOutputStreamImp::startSequence ( int  count,
RWStreamType  elementType,
const RWSymbol typeInfo 
) [virtual]

Called by the output operators for collection types at the start of a sequence.

Parameters:
count Contains the number of items in the collection.
elementType Contains the type of element in the collection.
typeInfo Contains the type of the collection itself.

Implements RWObjectOutputStreamImp.

virtual void RWCompactObjectOutputStreamImp::writeMemberInfo ( const RWSymbol memberName,
RWStreamType  memberType 
) [virtual]

Called for before each data member by the streamContents() function. Metadata about the field may or may not be written to the stream, depending on the implementation. This function returns true if data is actually written out. Otherwise, it returns false.

Parameters:
memberName Identifies the name of the member.
memberType Identifies the type of the member.

Implements RWObjectOutputStreamImp.

virtual void RWCompactObjectOutputStreamImp::writeNullPtr (  )  [virtual]

Output is a token representing a null pointer.

Implements RWObjectOutputStreamImp.

virtual void RWCompactObjectOutputStreamImp::writeTypeInfo ( const RWSymbol typeInfo  )  [virtual]

Outputs the type information required to factory an object of the correct dynamic type (derived class) on input.

Parameters:
typeInfo Identifies the type of the new object, if such information is available.

Implements RWObjectOutputStreamImp.

 All Classes Functions Variables Typedefs Enumerations Enumerator Friends

© 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.