rwlogo
SourcePro C++ 12.0

SourcePro® C++ API Reference Guide



   SourcePro C++
Documentation Home

RWCompactObjectInputStreamImp Class Reference
[Serialization]

Reads objects encoded in a compact format from the supplied RWDataInputStream. More...

#include <rw/serial/RWCompactObjectInputStreamImp.h>

Inheritance diagram for RWCompactObjectInputStreamImp:
RWObjectInputStreamImp RWFilteredDataInputStreamImp RWDataInputStreamImp RWInputStreamImp RWStreamImp RWBodyBase RWTCountingBody< RWMutexLock > RWTMonitor< RWMutexLock >

List of all members.

Public Member Functions

virtual RWSymbol startBlock ()
virtual void endBlock ()
virtual void * getNewObject (const std::type_info *base)
virtual RWSymbol readTypeInfo ()
virtual void rememberObject (const void *obj)
virtual bool startMember (RWSymbol &memberName, RWStreamType &memberType)
virtual RWSymbol startSequence (int &count, RWStreamType &elementType)
virtual RWSymbol startMap (int &count, RWStreamType &keyType, RWStreamType &valueType)
virtual void getString (RWCString &str)
virtual void getWString (RWWString &str)
virtual void getUString (RWBasicUString &str)

Static Public Member Functions

static RWObjectInputStream make (const RWDataInputStream &source, bool annotateStream=false)

Protected Member Functions

virtual void openOuterContext (bool readContext)
virtual void closeOuterContext (bool readContext)
 RWCompactObjectInputStreamImp (const RWDataInputStream &sourceStream, bool annotateStream)
virtual RWSize getString (char *string, RWSize count)
virtual RWSize getWString (wchar_t *wstring, RWSize count)
virtual RWSize getUString (RWUChar *ustring, RWSize count)

Detailed Description

The class RWCompactObjectInputStreamImp reads objects encoded in a compact format from the supplied RWDataInputStream. 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

 // Open an fstream to serve as our source.
 ifstream s("foo.dat");
 
 // Create a compact data stream using the fstream.
 RWObjectInputStream in = RWCompactObjectInputStreamImp::make( 
          RWDataToVirtualInputStream(s));
 
 // Read integer from compact data stream
 int i;
 s >> i;

Constructor & Destructor Documentation

RWCompactObjectInputStreamImp::RWCompactObjectInputStreamImp ( const RWDataInputStream sourceStream,
bool  annotateStream 
) [inline, protected]

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

Parameters:
sourceStream serves as a handle to the previous processing stream.
annotateStream indicates whether or not the stream is annotated.

Member Function Documentation

virtual void RWCompactObjectInputStreamImp::closeOuterContext ( bool  readContext  )  [protected, virtual]

Really closes an open context, called when closeContext() calls match the number of openContext() calls.

Implements RWObjectInputStreamImp.

virtual void RWCompactObjectInputStreamImp::endBlock (  )  [virtual]

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

Implements RWObjectInputStreamImp.

virtual void* RWCompactObjectInputStreamImp::getNewObject ( const std::type_info *  base  )  [virtual]

Reads the dynamic type information (derived class) from the input stream, and factories an instance of this type.

Parameters:
base Represents the static type (base class) of the field being read.

Implements RWObjectInputStreamImp.

virtual RWSize RWCompactObjectInputStreamImp::getString ( char *  string,
RWSize  count 
) [inline, protected, virtual]

Forward the reading of a string of narrow characters from the attached source stream. The function returns the number of narrow characters read.

Parameters:
string A pointer to the first element of the string. The string must have been pre-allocated to contain at least count narrow characters.
count The number of narrow character(s) to be read from the stream.

Reimplemented from RWObjectInputStreamImp.

virtual void RWCompactObjectInputStreamImp::getString ( RWCString value  )  [virtual]

Reads an RWCString value from the stream.

Parameters:
value The RWCString value to be read from the stream

Implements RWObjectInputStreamImp.

virtual RWSize RWCompactObjectInputStreamImp::getUString ( RWUChar ustring,
RWSize  count 
) [inline, protected, virtual]

Forward the reading of a string of UTF-16 characters from the attached source stream. The function returns the number of UTF-16 characters read.

Parameters:
ustring A pointer to the first element of the string. The string must have been pre-allocated to contain at least count unicode characters.
count The number of unicode character(s) to be read from the stream.

Reimplemented from RWObjectInputStreamImp.

virtual void RWCompactObjectInputStreamImp::getUString ( RWBasicUString value  )  [virtual]

Reads an RWBasicUString value from the stream.

Parameters:
value The RWBasicUString value to be read from the stream

Implements RWObjectInputStreamImp.

virtual RWSize RWCompactObjectInputStreamImp::getWString ( wchar_t *  wstring,
RWSize  count 
) [inline, protected, virtual]

Forward the reading of a string of wide characters from the attached source stream. The function returns the number of wide characters read.

Parameters:
wstring A pointer to the first element of the string. The string must have been pre-allocated to contain at least count wide characters.
count The number of wide character(s) to be read from the stream.

Reimplemented from RWObjectInputStreamImp.

virtual void RWCompactObjectInputStreamImp::getWString ( RWWString value  )  [virtual]

Reads an RWWString value from the stream.

Parameters:
value The RWWString value to be read from the stream

Implements RWObjectInputStreamImp.

static RWObjectInputStream RWCompactObjectInputStreamImp::make ( const RWDataInputStream source,
bool  annotateStream = false 
) [static]

Constructs an RWCompactObjectInputStreamImp instance that uses source as its source of bytes, and returns a handle to it. Throws no exceptions.

Parameters:
source is the data stream that is used as the source of bytes.
annotateStream indicates whether or not the stream is annotated.
virtual void RWCompactObjectInputStreamImp::openOuterContext ( bool  readContext  )  [protected, virtual]

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

Implements RWObjectInputStreamImp.

virtual RWSymbol RWCompactObjectInputStreamImp::readTypeInfo (  )  [virtual]

Reads the type information for an class instance from the stream and returns it as a symbol.

Implements RWObjectInputStreamImp.

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

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

Implements RWObjectInputStreamImp.

virtual RWSymbol RWCompactObjectInputStreamImp::startBlock (  )  [virtual]

Causes tokens to be input that identify the start of a new object. Returns an RWSymbol representing the new object. Depending on the implementation class associated with this handle the RWSymbol may be empty.

Implements RWObjectInputStreamImp.

virtual RWSymbol RWCompactObjectInputStreamImp::startMap ( int &  count,
RWStreamType keyType,
RWStreamType valueType 
) [virtual]

Called by the input operators for association types (hash tables, etc.) at the start. Returns an RWSymbol representing the collection.

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.

Implements RWObjectInputStreamImp.

virtual bool RWCompactObjectInputStreamImp::startMember ( RWSymbol memberName,
RWStreamType memberType 
) [virtual]

Called for before each data member by the streamContents() function, metadata about the field may or may not be read from the stream depending on the implementation. If data is read (returning true), then parameter memberName will contain the name of the member. Otherwise returns false.

Implements RWObjectInputStreamImp.

virtual RWSymbol RWCompactObjectInputStreamImp::startSequence ( int &  count,
RWStreamType elementType 
) [virtual]

Called by the input operators for collection types at the start of a sequence. Returns an RWSymbol representing the collection.

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

Implements RWObjectInputStreamImp.

 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.