Oracle Coherence for C++ API
Release 3.7.1.0

E22845-01

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.
 UserTypeReader (PofBufferReader::Handle hParent, 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 void registerIdentity (Object::Holder oh)
 Register an identity for a newly created user type instance.

If identity/reference types are enabled, an identity is used to uniquely identify a user type instance within a POF stream. The identity immediately proceeds the instance value in the POF stream and can be used later in the stream to reference the instance.

PofSerializer implementations must call this method with the user type instance instantiated during deserialization prior to reading any properties of the instance which are user type instances themselves.

Parameters:
 oh the object to register the identity for
See also:
PofSerializer::deserialize(PofReaderHandle)
Since:
Coherence 3.7.1
virtual PofReader::Handle createNestedPofReader (int32_t iProp)
 Obtain a PofReader that can be used to read a set of properties from a single property of the current user type.

The returned PofReader is only valid from the time that it is returned until the next call is made to this PofReader.

Parameters:
 iProp the property index to read from
Returns:
a PofReader that reads its contents from a single property of this PofReader
Exceptions:
 coherence::lang::IllegalArgumentException if the property index is invalid, or is less than or equal to the index of the previous property read from the POF stream
 coherence::lang::IllegalStateException if no user type is being parsed
 coherence::io::IOException if an I/O error occurs
Since:
Coherence 3.6
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
virtual void closeNested ()
 Notify the UserTypeReader that it is being "closed".
virtual
PofBufferReader::Handle 
getParentParser ()
 If this parser is contextually within a user type, obtain the parser which created this parser in order to parse the user type.

Returns:
the parser for the context within which this parser is operating
virtual
PofBufferReader::View 
getParentParser () const
 If this parser is contextually within a user type, obtain the parser which created this parser in order to parse the user type.

Returns:
the parser for the context within which this parser is operating

Protected Attributes

MemberHandle
< PofBufferReader
m_hParent
 The parent (ie containing) PofBufferReader.
int32_t m_nTypeId
 The type identifier of the user type that is being parsed.
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.
MemberHandle
< UserTypeReader
m_hReaderNested
 The currently open nested reader, if any.
int32_t m_iNestedProp
 The property index of the property from which the currently open nested reader is reading from.

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

UserTypeReader ( PofBufferReader::Handle  hParent,
    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:
 hParent the parent (ie the containing) PofBufferReader
 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 Function Documentation

virtual void closeNested (  )  [protected, virtual]

Notify the UserTypeReader that it is being "closed".

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 © 2000, 2011, Oracle and/or its affiliates. All rights reserved.