SourcePro® API Reference Guide

 
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
RWObjectOutputStreamImp Class Referenceabstract

Base class for all object output stream implementations. More...

#include <rw/serial/RWObjectOutputStreamImp.h>

Inheritance diagram for RWObjectOutputStreamImp:
RWFilteredDataOutputStreamImp RWDataOutputStreamImp RWOutputStreamImp RWStreamImp RWBodyBase RWTCountingBody< RWMutexLock > RWTMonitor< RWMutexLock > RWCompactObjectOutputStreamImp RWEnhancedXmlObjectOutputStreamImp RWXmlObjectOutputStreamImp RWTParsedTransformObjectOutputStreamImp< Transform > RWTTransformObjectOutputStreamImp< Transform >

Public Member Functions

virtual void closeContext (bool writeContext=true)
 
virtual void endAssoc ()
 
virtual void endBlock ()=0
 
virtual void endElement ()
 
virtual void endMap ()
 
virtual void endMember (const RWSymbol &)
 
virtual void endParent ()
 
virtual void endSequence ()
 
virtual bool needToWrite (const void *obj)=0
 
virtual void newObjectMarker ()=0
 
virtual void openContext (bool writeContext=true)
 
virtual void putString (const RWCString &str)=0
 
virtual void putSymbol (const RWSymbol &sym)
 
virtual void putUString (const RWBasicUString &str)=0
 
virtual void putWString (const RWWString &str)=0
 
virtual void rememberObject (const void *obj)=0
 
virtual void setNameForNextObject (const RWCString &str)=0
 
virtual void startAssocKey ()
 
virtual void startAssocValue ()
 
virtual void startBlock (const RWSymbol &typeInfo)=0
 
virtual void startElement (int)
 
virtual void startMap (int count, RWStreamType keyType, RWStreamType valueType, const RWSymbol &typeInfo)=0
 
virtual void startParent (const RWSymbol &)
 
virtual void startSequence (int count, RWStreamType elementType, const RWSymbol &typeInfo)=0
 
virtual void writeMemberInfo (const RWSymbol &memberName, RWStreamType memberType)=0
 
virtual void writeNullPtr ()=0
 
virtual void writeTypeInfo (const RWSymbol &typeInfo)=0
 
- Public Member Functions inherited from RWFilteredDataOutputStreamImp
virtual ~RWFilteredDataOutputStreamImp ()
 
virtual void close ()
 
virtual void flush ()
 
virtual bool isBad () const
 
virtual bool isFail () const
 
virtual bool isGood () const
 
virtual void putBool (bool value)
 
virtual void putBools (const bool *arrayPt, RWSize count)
 
virtual void putChar (char value)
 
virtual void putCharacter (char value)
 
virtual void putChars (const char *arrayPt, RWSize count)
 
virtual void putDouble (double value)
 
virtual void putDoubles (const double *arrayPt, RWSize count)
 
virtual void putFloat (float value)
 
virtual void putFloats (const float *arrayPt, RWSize count)
 
virtual void putInt (int value)
 
virtual void putInts (const int *arrayPt, RWSize count)
 
virtual void putLong (long value)
 
virtual void putLongDouble (long double value)
 
virtual void putLongDoubles (const long double *arrayPt, RWSize count)
 
virtual void putLongLong (long long value)
 
virtual void putLongLongs (const long long *arrayPt, RWSize count)
 
virtual void putLongs (const long *arrayPt, RWSize count)
 
virtual void putShort (short value)
 
virtual void putShorts (const short *arrayPt, RWSize count)
 
virtual void putSignedChar (signed char value)
 
virtual void putSignedChars (const signed char *arrayPt, RWSize count)
 
virtual void putSizeT (size_t value)
 
virtual void putUCharacter (RWUChar value)
 
virtual void putUnsignedChar (unsigned char value)
 
virtual void putUnsignedChars (const unsigned char *arrayPt, RWSize count)
 
virtual void putUnsignedInt (unsigned int value)
 
virtual void putUnsignedInts (const unsigned int *arrayPt, RWSize count)
 
virtual void putUnsignedLong (unsigned long value)
 
virtual void putUnsignedLongLong (unsigned long long value)
 
virtual void putUnsignedLongLongs (const unsigned long long *arrayPt, RWSize count)
 
virtual void putUnsignedLongs (const unsigned long *arrayPt, RWSize count)
 
virtual void putUnsignedShort (unsigned short value)
 
virtual void putUnsignedShorts (const unsigned short *arrayPt, RWSize count)
 
virtual void putWchar_t (wchar_t value)
 
virtual void putWchar_ts (const wchar_t *arrayPt, RWSize count)
 
virtual void putWCharacter (wchar_t value)
 
- Public Member Functions inherited from RWDataOutputStreamImp
virtual ~RWDataOutputStreamImp ()
 
virtual RWDataOutputStream acquire ()
 
virtual void release ()
 
- Public Member Functions inherited from RWOutputStreamImp
virtual ~RWOutputStreamImp ()
 
- Public Member Functions inherited from RWStreamImp
virtual ~RWStreamImp ()
 

Protected Member Functions

 RWObjectOutputStreamImp (const RWDataOutputStream &sinkStream)
 
virtual void closeOuterContext (bool writeContext)=0
 
int getContextNestingLevel ()
 
virtual void openOuterContext (bool writeContext)=0
 
virtual void putString (const char *string, RWSize count)
 
virtual void putUString (const RWUChar *ustring, RWSize count)
 
virtual void putWString (const wchar_t *wstring, RWSize count)
 
- Protected Member Functions inherited from RWFilteredDataOutputStreamImp
 RWFilteredDataOutputStreamImp (const RWDataOutputStream &sinkStream)
 
RWDataOutputStreamgetSinkStream ()
 
const RWDataOutputStreamgetSinkStream () const
 
- Protected Member Functions inherited from RWDataOutputStreamImp
 RWDataOutputStreamImp ()
 
- Protected Member Functions inherited from RWOutputStreamImp
 RWOutputStreamImp ()
 
- Protected Member Functions inherited from RWStreamImp
 RWStreamImp ()
 
- Protected Member Functions inherited from RWBodyBase
 RWBodyBase (void)
 
 RWBodyBase (RWStaticCtor)
 
 RWBodyBase (const RWBodyBase &second)
 
virtual ~RWBodyBase (void)
 
RWBodyBaseoperator= (const RWBodyBase &second)
 
- Protected Member Functions inherited from RWTCountingBody< RWMutexLock >
 RWTCountingBody (unsigned initCount=0)
 
 RWTCountingBody (RWStaticCtor)
 
 RWTCountingBody (const RWTCountingBody< RWMutexLock > &second)
 
RWTCountingBody< RWMutexLock > & operator= (const RWTCountingBody< RWMutexLock > &second)
 
 ~RWTCountingBody (void)
 
unsigned addReference (void)
 
unsigned references (void) const
 
unsigned removeReference (void)
 
- Protected Member Functions inherited from RWTMonitor< RWMutexLock >
 RWTMonitor ()
 
 RWTMonitor (RWStaticCtor)
 
 RWTMonitor (const RWTMonitor< RWMutexLock > &second)
 
 ~RWTMonitor ()
 
void acquire ()
 
bool isAcquired () const
 
RWTMonitor< RWMutexLock > & monitor () const
 
RWMutexLockmutex ()
 
RWTMonitor< RWMutexLock > & operator= (const RWTMonitor< RWMutexLock > &)
 
void release ()
 
bool tryAcquire ()
 

Protected Attributes

RWCString nameForNextObject_
 

Additional Inherited Members

- Protected Types inherited from RWTCountingBody< RWMutexLock >
typedef RWTLockGuard< RWTMonitor< RWMutexLock > > LockGuard
 
typedef RWTTryLockGuard< RWTMonitor< RWMutexLock > > TryLockGuard
 
typedef RWTUnlockGuard< RWTMonitor< RWMutexLock > > UnlockGuard
 
- Protected Types inherited from RWTMonitor< RWMutexLock >
typedef RWTLockGuard< RWTMonitor< RWMutexLock > > LockGuard
 
typedef RWTTryLockGuard< RWTMonitor< RWMutexLock > > TryLockGuard
 
typedef RWTUnlockGuard< RWTMonitor< RWMutexLock > > UnlockGuard
 

Detailed Description

Base class for all object output stream implementations. Inherits default operations for streaming primitives from the data output stream.

See the corresponding handle class, RWObjectOutputStream, for the description of the object output stream interface.

Constructor & Destructor Documentation

RWObjectOutputStreamImp::RWObjectOutputStreamImp ( const RWDataOutputStream sinkStream)
inlineprotected

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

Parameters
sinkStreamA handle to the next processing stream.

Member Function Documentation

virtual void RWObjectOutputStreamImp::closeContext ( bool  writeContext = true)
inlinevirtual

Called by RWWithObjectOutputContext dtor to close an open context.

virtual void RWObjectOutputStreamImp::closeOuterContext ( bool  writeContext)
protectedpure virtual

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

Implemented in RWXmlObjectOutputStreamImp, RWEnhancedXmlObjectOutputStreamImp, and RWCompactObjectOutputStreamImp.

virtual void RWObjectOutputStreamImp::endAssoc ( )
inlinevirtual

Called by the output operators for association types after each value.

Reimplemented in RWXmlObjectOutputStreamImp, and RWEnhancedXmlObjectOutputStreamImp.

virtual void RWObjectOutputStreamImp::endBlock ( )
pure virtual

Outputs tokens that identify the end of an object.

Implemented in RWXmlObjectOutputStreamImp, RWEnhancedXmlObjectOutputStreamImp, and RWCompactObjectOutputStreamImp.

virtual void RWObjectOutputStreamImp::endElement ( )
inlinevirtual

Called by the output operators for collection types after each element in a sequence.

Reimplemented in RWXmlObjectOutputStreamImp, and RWEnhancedXmlObjectOutputStreamImp.

virtual void RWObjectOutputStreamImp::endMap ( )
inlinevirtual

Called by the output operators for association types after all the pairs.

Reimplemented in RWXmlObjectOutputStreamImp, and RWEnhancedXmlObjectOutputStreamImp.

virtual void RWObjectOutputStreamImp::endMember ( const RWSymbol )
inlinevirtual

Called by streamContents() after each data member is written.

Reimplemented in RWXmlObjectOutputStreamImp, and RWEnhancedXmlObjectOutputStreamImp.

virtual void RWObjectOutputStreamImp::endParent ( )
inlinevirtual

Outputs tokens that identify the end of an parent class.

virtual void RWObjectOutputStreamImp::endSequence ( )
inlinevirtual

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

Reimplemented in RWXmlObjectOutputStreamImp, and RWEnhancedXmlObjectOutputStreamImp.

int RWObjectOutputStreamImp::getContextNestingLevel ( )
inlineprotected

Returns the current context nesting level. 0 indicates no open context.

virtual bool RWObjectOutputStreamImp::needToWrite ( const void *  obj)
pure 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 having been previously streamed, and the function returns false.

Implemented in RWXmlObjectOutputStreamImp, RWEnhancedXmlObjectOutputStreamImp, and RWCompactObjectOutputStreamImp.

virtual void RWObjectOutputStreamImp::newObjectMarker ( )
pure virtual

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

Implemented in RWXmlObjectOutputStreamImp, RWEnhancedXmlObjectOutputStreamImp, and RWCompactObjectOutputStreamImp.

virtual void RWObjectOutputStreamImp::openContext ( bool  writeContext = true)
inlinevirtual

Called by RWWithObjectOutputContext ctor to open a context in which multiple references to a single object are resolved.

virtual void RWObjectOutputStreamImp::openOuterContext ( bool  writeContext)
protectedpure virtual

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

Implemented in RWXmlObjectOutputStreamImp, RWEnhancedXmlObjectOutputStreamImp, and RWCompactObjectOutputStreamImp.

virtual void RWObjectOutputStreamImp::putString ( const RWCString str)
pure virtual
virtual void RWObjectOutputStreamImp::putString ( const char *  string,
RWSize  count 
)
inlineprotectedvirtual

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

Parameters
stringA pointer to the narrow string's first character.
countThe number of narrow character(s) to be written to the stream.

Reimplemented from RWFilteredDataOutputStreamImp.

Reimplemented in RWXmlObjectOutputStreamImp, RWEnhancedXmlObjectOutputStreamImp, and RWCompactObjectOutputStreamImp.

virtual void RWObjectOutputStreamImp::putSymbol ( const RWSymbol sym)
virtual

Writes an RWSymbol to the stream.

virtual void RWObjectOutputStreamImp::putUString ( const RWBasicUString str)
pure virtual
virtual void RWObjectOutputStreamImp::putUString ( const RWUChar ustring,
RWSize  count 
)
inlineprotectedvirtual

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

Parameters
ustringA pointer to the string's first unicode character.
countThe number of unicode character(s) to be written to the stream.

Reimplemented from RWFilteredDataOutputStreamImp.

Reimplemented in RWXmlObjectOutputStreamImp, RWEnhancedXmlObjectOutputStreamImp, and RWCompactObjectOutputStreamImp.

virtual void RWObjectOutputStreamImp::putWString ( const RWWString str)
pure virtual
virtual void RWObjectOutputStreamImp::putWString ( const wchar_t *  wstring,
RWSize  count 
)
inlineprotectedvirtual

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

Parameters
wstringA pointer to the string's first wide character.
countThe number of wide character(s) to be written to the stream.

Reimplemented from RWFilteredDataOutputStreamImp.

Reimplemented in RWXmlObjectOutputStreamImp, RWEnhancedXmlObjectOutputStreamImp, and RWCompactObjectOutputStreamImp.

virtual void RWObjectOutputStreamImp::rememberObject ( const void *  obj)
pure virtual

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

Parameters
objHolds the address of the instance.

Implemented in RWXmlObjectOutputStreamImp, RWEnhancedXmlObjectOutputStreamImp, and RWCompactObjectOutputStreamImp.

virtual void RWObjectOutputStreamImp::setNameForNextObject ( const RWCString str)
pure virtual

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

Implemented in RWXmlObjectOutputStreamImp, RWEnhancedXmlObjectOutputStreamImp, and RWCompactObjectOutputStreamImp.

virtual void RWObjectOutputStreamImp::startAssocKey ( )
inlinevirtual

Called by the output operators for association types before each key.

Reimplemented in RWXmlObjectOutputStreamImp, and RWEnhancedXmlObjectOutputStreamImp.

virtual void RWObjectOutputStreamImp::startAssocValue ( )
inlinevirtual

Called by the output operators for association types after each key and before each value.

Reimplemented in RWXmlObjectOutputStreamImp, and RWEnhancedXmlObjectOutputStreamImp.

virtual void RWObjectOutputStreamImp::startBlock ( const RWSymbol typeInfo)
pure virtual

Outputs tokens that identify the start of a new object.

Parameters
typeInfoIdentifies the type of the new object, if such information is available.

Implemented in RWXmlObjectOutputStreamImp, RWEnhancedXmlObjectOutputStreamImp, and RWCompactObjectOutputStreamImp.

virtual void RWObjectOutputStreamImp::startElement ( int  )
inlinevirtual

Called by the output operators for collection types before each element in a sequence.

Reimplemented in RWXmlObjectOutputStreamImp, and RWEnhancedXmlObjectOutputStreamImp.

virtual void RWObjectOutputStreamImp::startMap ( int  count,
RWStreamType  keyType,
RWStreamType  valueType,
const RWSymbol typeInfo 
)
pure virtual

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

Parameters
countContains the number of items in the association.
keyTypeContains the type of key in the association.
valueTypeContains the type of value in the association.
typeInfoContains the type of the association (collection) itself.

Implemented in RWXmlObjectOutputStreamImp, RWEnhancedXmlObjectOutputStreamImp, and RWCompactObjectOutputStreamImp.

virtual void RWObjectOutputStreamImp::startParent ( const RWSymbol )
inlinevirtual

Outputs tokens that identify the start of a parent class.

virtual void RWObjectOutputStreamImp::startSequence ( int  count,
RWStreamType  elementType,
const RWSymbol typeInfo 
)
pure virtual

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

Parameters
countContains the number of items in the collection.
elementTypeContains the type of element in the collection.
typeInfoContains the type of the collection itself.

Implemented in RWXmlObjectOutputStreamImp, RWEnhancedXmlObjectOutputStreamImp, and RWCompactObjectOutputStreamImp.

virtual void RWObjectOutputStreamImp::writeMemberInfo ( const RWSymbol memberName,
RWStreamType  memberType 
)
pure 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
memberNameIdentifies the name of the member.
memberTypeIdentifies the type of the member.

Implemented in RWXmlObjectOutputStreamImp, RWEnhancedXmlObjectOutputStreamImp, and RWCompactObjectOutputStreamImp.

virtual void RWObjectOutputStreamImp::writeNullPtr ( )
pure virtual

Output is a token representing a null pointer.

Implemented in RWXmlObjectOutputStreamImp, RWEnhancedXmlObjectOutputStreamImp, and RWCompactObjectOutputStreamImp.

virtual void RWObjectOutputStreamImp::writeTypeInfo ( const RWSymbol typeInfo)
pure virtual

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

Parameters
typeInfoIdentifies the type of the new object, if such information is available.

Implemented in RWXmlObjectOutputStreamImp, RWEnhancedXmlObjectOutputStreamImp, and RWCompactObjectOutputStreamImp.

Member Data Documentation

RWCString RWObjectOutputStreamImp::nameForNextObject_
protected

The name for the next object inserted or extracted. This name will be cleared as soon as an object has been written or read, and ignored if empty.

Copyright © 2022 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.