UserTypeReader Class Reference

#include <coherence/io/pof/UserTypeReader.hpp>

Inherits PofBufferReader.

List of all members.


Detailed Description

The UserTypeReader implementation is a contextually-aware PofReader whose purpose is to advance through the properties of a value of a specified user type.

The "contextual awareness" refers to the fact that the UserTypeReader maintains state about the type identifier and version of the user type, the parser's property index position within the user type value, and a PofContext that may differ from the PofContext that provided the PofSerializer which is using this UserTypeReader to parse a user type.

Author:
jh 2008.04.11

Public Types

typedef spec::Handle Handle
 UserTypeReader Handle definition.
typedef spec::View View
 UserTypeReader View definition.
typedef spec::Holder Holder
 UserTypeReader Holder definition.

Public Member Functions

 UserTypeReader (ReadBuffer::BufferInput::Handle hIn, PofContext::View vCtx, int32_t nTypeId, int32_t nVersionId)
 Construct a parser for parsing the property values of a user type.
virtual int32_t getUserTypeId () const
 Determine the user type that is currently being parsed.

Returns:
the user type information, or -1 if the PofReader is not currently parsing a user type

virtual int32_t getVersionId () const
 Determine the version identifier of the user type that is currently being parsed.

Returns:
the integer version ID read from the POF stream; always non-negative
Exceptions:
coherence::lang::IllegalStateException if no user type is being parsed

virtual Binary::View readRemainder ()
 Read all remaining indexed properties of the current user type from the POF stream.

As part of reading in a user type, this method must be called by the PofSerializer that is reading the user type, or the read position within the POF stream will be corrupted.

Subsequent calls to the various readXYZ methods of this interface will fail after this method is called.

Returns:
a buffer containing zero or more indexed properties in binary POF encoded form
Exceptions:
coherence::lang::IllegalStateException if no user type is being parsed
coherence::io::IOException if an I/O error occurs


Protected Member Functions

virtual bool advanceTo (int32_t iProp)
 Advance through the POF stream until the specified property is found.

If the property is found, return true, otherwise return false and advance to the first property that follows the specified property.

Parameters:
iProp the index of the property to advance to
Returns:
true if the property is found
Exceptions:
IllegalStateException if the POF stream has already advanced past the desired property
IOException if an I/O error occurs

virtual void complete (int32_t iProp)
 Register the completion of the parsing of a value.

Parameters:
iProp the property index
Exceptions:
IOException if an I/O error occurs


Protected Attributes

const int32_t m_nTypeId
 The type identifier of the user type that is being parsed.
const int32_t m_nVersionId
 The version identifier of the user type that is being parsed.
int32_t m_iPrevProp
 Most recent property read or (if it were missing) requested.
int32_t m_iNextProp
 The index of the next property in the POF stream.
size32_t m_ofNextProp
 The offset of the index of the next property to read.

Constructor & Destructor Documentation

UserTypeReader ( ReadBuffer::BufferInput::Handle  hIn,
PofContext::View  vCtx,
int32_t  nTypeId,
int32_t  nVersionId 
)

Construct a parser for parsing the property values of a user type.

Parameters:
hIn the BufferInput that contains the user type data, except for the user type id itself (which is passed passed as a constructor argument)
vCtx the PofContext to use for parsing the user type property values within the user type that this parser will be parsing
nTypeId the type id of the user type
nVersionId the version id of the user type
Exceptions:
IOException if an I/O error occurs


Member Data Documentation

int32_t m_iPrevProp [protected]

Most recent property read or (if it were missing) requested.

This is used to determine if the client is attempting to read properties in the wrong order.


The documentation for this class was generated from the following file: Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.