Oracle Coherence for C++ API
Release 3.6.0.0

E15728-01

WritingPofHandler Class Reference

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

Inherits PofHelper, and PofHandler.

List of all members.


Detailed Description

An implementation of PofHandler that writes a POF stream to a WriteBuffer using a BufferOutput object.
Author:
jh 2008.04.09

Public Types

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

Public Member Functions

virtual void  registerIdentity (int32_t nId)
  This method is invoked when an identity is encountered in the POF stream.

The identity is used to uniquely identify the next value in the POF stream, and can be later referenced by the onIdentityReference method.

Parameters:
nId  if (nId >= 0), then this is the identity encountered in the POF stream, otherwise it is an indicator that the following value could have been assigned an identifier but was not (i.e. that the subsequent value is of a referenceable data type)

virtual void  onNullReference (int32_t iPos)
  Specifies that a NULL value has been encountered in the POF stream.
Parameters:
iPos  context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a map, -1 otherwise

virtual void  onIdentityReference (int32_t iPos, int32_t nId)
  Specifies that a reference to a previously-identified value has been encountered in the POF stream.
Parameters:
iPos  context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a map, -1 otherwise
nId  the identity of the previously encountered value, as was specified in a previous call to registerIdentity

virtual void  onInt16 (int32_t iPos, int16_t n)
  Report that a short integer value has been encountered in the POF stream.
Parameters:
iPos  context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a map, -1 otherwise
n  the integer value as a short

virtual void  onInt32 (int32_t iPos, int32_t n)
  Report that an integer value has been encountered in the POF stream.
Parameters:
iPos  context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a map, -1 otherwise
n  the integer value as an int32_t

virtual void  onInt64 (int32_t iPos, int64_t n)
  Report that a long integer value has been encountered in the POF stream.
Parameters:
iPos  context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a map, -1 otherwise
n  the integer value as a long

virtual void  onFloat32 (int32_t iPos, float32_t fl)
  Report that a base-2 single-precision floating-point value has been encountered in the POF stream.
Parameters:
iPos  context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a map, -1 otherwise
fl  the floating-point value as a float32_t

virtual void  onFloat64 (int32_t iPos, float64_t dfl)
  Report that a base-2 double-precision floating-point value has been encountered in the POF stream.
Parameters:
iPos  context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a map, -1 otherwise
dfl  the floating-point value as a float64_t

virtual void  onBoolean (int32_t iPos, bool f)
  Report that a boolean value has been encountered in the POF stream.
Parameters:
iPos  context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a map, -1 otherwise
f  the boolean value

virtual void  onOctet (int32_t iPos, octet_t b)
  Report that an octet value (a byte) has been encountered in the POF stream.
Parameters:
iPos  context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a map, -1 otherwise
b  the octet value

virtual void  onOctetString (int32_t iPos, Binary::View vBin)
  Report that a octet string value has been encountered in the POF stream.
Parameters:
iPos  context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a map, -1 otherwise
vBin  the octect string value as a Binary object

virtual void  onChar (int32_t iPos, char16_t ch)
  Report that a character value has been encountered in the POF stream.
Parameters:
iPos  context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a map, -1 otherwise
ch  the character value as a char16_t

virtual void  onCharString (int32_t iPos, String::View vs)
  Report that a character string value has been encountered in the POF stream.
Parameters:
iPos  context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a map, -1 otherwise
vs  the character string value as a String object

virtual void  onDate (int32_t iPos, int32_t nYear, int32_t nMonth, int32_t nDay)
  Report that a date value has been encountered in the POF stream.
Parameters:
iPos  context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a map, -1 otherwise
nYear  the year number as defined by ISO8601
nMonth  the month number between 1 and 12 inclusive as defined by ISO8601
nDay  the day number between 1 and 31 inclusive as defined by ISO8601

virtual void  onYearMonthInterval (int32_t iPos, int32_t cYears, int32_t cMonths)
  Report that a year-month interval value has been encountered in the POF stream.
Parameters:
iPos  context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a map, -1 otherwise
cYears  the number of years in the year-month interval
cMonths  the number of months in the year-month interval

virtual void  onTime (int32_t iPos, int32_t nHour, int32_t nMinute, int32_t nSecond, int32_t nNano, bool fUTC)
  Report that a time value has been encountered in the POF stream.
Parameters:
iPos  context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a map, -1 otherwise
nHour  the hour between 0 and 23 inclusive
nMinute  the minute value between 0 and 59 inclusive
nSecond  the second value between 0 and 59 inclusive (and theoretically 60 for a leap-second)
nNano  the nanosecond value between 0 and 999999999 inclusive
fUTC  true if the time value is UTC or false if the time value does not have an explicit time zone

virtual void  onTime (int32_t iPos, int32_t nHour, int32_t nMinute, int32_t nSecond, int32_t nNano, int32_t nHourOffset, int32_t nMinuteOffset)
  Report that a time value (with a timezone offset) has been encountered in the POF stream.
Parameters:
iPos  context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a map, -1 otherwise
nHour  the hour between 0 and 23 inclusive
nMinute  the minute value between 0 and 59 inclusive
nSecond  the second value between 0 and 59 inclusive (and theoretically 60 for a leap-second)
nNano  the nanosecond value between 0 and 999999999 inclusive
nHourOffset  the timezone offset in hours from UTC, for example 0 for BST, -5 for EST and 1 for CET
nMinuteOffset  the timezone offset in minutes, for example 0 (in most cases) or 30
See also:
worldtimezone.com

virtual void  onTimeInterval (int32_t iPos, int32_t cHours, int32_t cMinutes, int32_t cSeconds, int32_t cNanos)
  Report that a time interval value has been encountered in the POF stream.
Parameters:
iPos  context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a map, -1 otherwise
cHours  the number of hours in the time interval
cMinutes  the number of minutes in the time interval, from 0 to 59 inclusive
cSeconds  the number of seconds in the time interval, from 0 to 59 inclusive
cNanos  the number of nanoseconds, from 0 to 999999999 inclusive

virtual void  onDateTime (int32_t iPos, int32_t nYear, int32_t nMonth, int32_t nDay, int32_t nHour, int32_t nMinute, int32_t nSecond, int32_t nNano, bool fUTC)
  Report that a date-time value has been encountered in the POF stream.
Parameters:
iPos  context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a map, -1 otherwise
nYear  the year number as defined by ISO8601
nMonth  the month number between 1 and 12 inclusive as defined by ISO8601
nDay  the day number between 1 and 31 inclusive as defined by ISO8601
nHour  the hour between 0 and 23 inclusive
nMinute  the minute value between 0 and 59 inclusive
nSecond  the second value between 0 and 59 inclusive (and theoretically 60 for a leap-second)
nNano  the nanosecond value between 0 and 999999999 inclusive
fUTC  true if the time value is UTC or false if the time value does not have an explicit time zone

virtual void  onDateTime (int32_t iPos, int32_t nYear, int32_t nMonth, int32_t nDay, int32_t nHour, int32_t nMinute, int32_t nSecond, int32_t nNano, int32_t nHourOffset, int32_t nMinuteOffset)
  Report that a date-time value (with a timezone offset) has been encountered in the POF stream.
Parameters:
iPos  context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a map, -1 otherwise
nYear  the year number as defined by ISO8601
nMonth  the month number between 1 and 12 inclusive as defined by ISO8601
nDay  the day number between 1 and 31 inclusive as defined by ISO8601
nHour  the hour between 0 and 23 inclusive
nMinute  the minute value between 0 and 59 inclusive
nSecond  the second value between 0 and 59 inclusive (and theoretically 60 for a leap-second)
nNano  the nanosecond value between 0 and 999999999 inclusive
nHourOffset  the timezone offset in hours from UTC, for example 0 for BST, -5 for EST and 1 for CET
nMinuteOffset  the timezone offset in minutes, for example 0 (in most cases) or 30

virtual void  onDayTimeInterval (int32_t iPos, int32_t cDays, int32_t cHours, int32_t cMinutes, int32_t cSeconds, int32_t cNanos)
  Report that a day-time interval value has been encountered in the POF stream.
Parameters:
iPos  context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a map, -1 otherwise
cDays  the number of days in the day-time interval
cHours  the number of hours in the day-time interval, from 0 to 23 inclusive
cMinutes  the number of minutes in the day-time interval, from 0 to 59 inclusive
cSeconds  the number of seconds in the day-time interval, from 0 to 59 inclusive
cNanos  the number of nanoseconds in the day-time interval, from 0 to 999999999 inclusive

virtual void  beginCollection (int32_t iPos, size32_t cElements)
  Report that a collection of values has been encountered in the POF stream.

This method call will be followed by a separate call to an "on" or "begin" method for each of the cElements elements in the collection, and the collection extent will then be terminated by a call to endComplexValue().

Parameters:
iPos  context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a map, -1 otherwise
cElements  the exact number of values (elements) in the collection

virtual void  beginUniformCollection (int32_t iPos, size32_t cElements, int32_t nType)
  Report that a uniform collection of values has been encountered in the POF stream.

This method call will be followed by a separate call to an "on" or "begin" method for each of the cElements elements in the collection, and the collection extent will then be terminated by a call to endComplexValue().

Parameters:
iPos  context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a map, -1 otherwise
cElements  the exact number of values (elements) in the collection
nType  the type identifier for all of the values in the uniform collection

virtual void  beginArray (int32_t iPos, size32_t cElements)
  Report that an array of values has been encountered in the POF stream.

This method call will be followed by a separate call to an "on" or "begin" method for each of the cElements elements in the array, and the array extent will then be terminated by a call to endComplexValue().

Parameters:
iPos  context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a map, -1 otherwise
cElements  the exact number of values (elements) in the array

virtual void  beginUniformArray (int32_t iPos, size32_t cElements, int32_t nType)
  Report that a uniform array of values has been encountered in the POF stream.

This method call will be followed by a separate call to an "on" or "begin" method for each of the cElements elements in the array, and the array extent will then be terminated by a call to endComplexValue().

Parameters:
iPos  context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a map, -1 otherwise
cElements  the exact number of values (elements) in the array
nType  the type identifier for all of the values in the uniform array

virtual void  beginSparseArray (int32_t iPos, size32_t cElements)
  Report that a sparse array of values has been encountered in the POF stream.

This method call will be followed by a separate call to an "on" or "begin" method for present element in the sparse array (up to cElements elements), and the array extent will then be terminated by a call to endComplexValue().

Parameters:
iPos  context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a map, -1 otherwise
cElements  the exact number of elements in the array, which is greater than or equal to the number of values in the sparse POF stream; in other words, the number of values that will subsequently be reported will not exceed this number

virtual void  beginUniformSparseArray (int32_t iPos, size32_t cElements, int32_t nType)
  Report that a uniform sparse array of values has been encountered in the POF stream.

This method call will be followed by a separate call to an "on" or "begin" method for present element in the sparse array (up to cElements elements), and the array extent will then be terminated by a call to endComplexValue().

Parameters:
iPos  context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a map, -1 otherwise
cElements  the exact number of elements in the array, which is greater than or equal to the number of values in the sparse POF stream; in other words, the number of values that will subsequently be reported will not exceed this number
nType  the type identifier for all of the values in the uniform sparse array

virtual void  beginMap (int32_t iPos, size32_t cElements)
  Report that a map of key/value pairs has been encountered in the POF stream.

This method call will be followed by a separate call to an "on" or "begin" method for each of the cElements elements in the map, and the map extent will then be terminated by a call to endComplexValue().

Parameters:
iPos  context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a map, -1 otherwise
cElements  the exact number of key/value pairs (entries) in the map

virtual void  beginUniformKeysMap (int32_t iPos, size32_t cElements, int32_t nTypeKeys)
  Report that a map of key/value pairs (with the keys being of a uniform type) has been encountered in the POF stream.

This method call will be followed by a separate call to an "on" or "begin" method for each of the cElements elements in the map, and the map extent will then be terminated by a call to endComplexValue().

Parameters:
iPos  context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a map, -1 otherwise
cElements  the exact number of key/value pairs (entries) in the map
nTypeKeys  the type identifier for all of the keys in the uniform-keys map

virtual void  beginUniformMap (int32_t iPos, size32_t cElements, int32_t nTypeKeys, int32_t nTypeValues)
  Report that a map of key/value pairs (with the keys being of a uniform type and the values being of a uniform type) has been encountered in the POF stream.

This method call will be followed by a separate call to an "on" or "begin" method for each of the cElements elements in the map, and the map extent will then be terminated by a call to endComplexValue().

Parameters:
iPos  context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a map, -1 otherwise
cElements  the exact number of key/value pairs (entries) in the map
nTypeKeys  the type identifier for all of the keys in the uniform map
nTypeValues  the type identifier for all of the values in the uniform map

virtual void  beginUserType (int32_t iPos, int32_t nUserTypeId, int32_t nVersionId)
  Report that a value of a "user type" has been encountered in the POF stream.

A user type is analogous to a "class", and a value of a user type is analogous to an "object".

This method call will be followed by a separate call to an "on" or "begin" method for each of the property values in the user type, and the user type will then be terminated by a call to endComplexValue().

Parameters:
iPos  context-sensitive position information: property index within a user type, array index within an array, element counter within a collection, entry counter within a map, -1 otherwise
nUserTypeId  the user type identifier, (nUserTypeId >= 0)
nVersionId  the version identifier for the user data type data in the POF stream, (nVersionId >= 0)

virtual void  endComplexValue ()
  Signifies the termination of the current complex value.

Complex values are any of the collection, array, map and user types. For each call to one of the "begin" methods, there will be a corresponding call to this method, even if there were no contents in the complex value.

virtual
WriteBuffer::BufferOutput::Handle 
getBufferOutput ()
  Obtain the DataOutput object that this Writing POF Handler is writing to.
virtual
WriteBuffer::BufferOutput::View 
getBufferOutput () const
  Obtain the DataOutput object that this Writing POF Handler is writing to.
virtual Complex::Handle  getComplex ()
  Obtain the current Complex object that represents the complex type that is being written to the POF stream.
virtual Complex::View  getComplex () const
  Obtain the current Complex object that represents the complex type that is being written to the POF stream.

Protected Member Functions

  WritingPofHandler (WriteBuffer::BufferOutput::Handle hOut)
  Construct a Writing POF Handler that will write a POF stream to the passed BufferOutput object.
virtual bool  isSkippable () const
  Determine if the value encoding can be skipped.
virtual bool  isCompressable () const
  Determine if the value encoding can be compressed by combining type and value information in such a way that type information could be lost.
virtual void  encodePosition (int32_t iPos)
  Called for each and every value going into the POF stream, in case the value needs its position to be encoded into the stream.
virtual bool  isTypeIdEncoded (int32_t nTypeId) const
  Determine if the type should be encoded for the current value.

Protected Attributes

FinalHandle
< WriteBuffer::BufferOutput
m_hOut
  The BufferOutput to write to.
MemberHandle< Complex m_hComplex
  The current containing Complex value in the POF stream.
bool  m_fHasIdentity
  Set to true when the next value to write has been tagged with an identity.

Classes

class   Complex
  A Complex object represents the current complex data structure in the POF stream. More...
class   ComplexMap
  A ComplexMap object represents a map data structure (with uniform keys or with uniform keys and values) in the POF stream. More...

Constructor & Destructor Documentation

WritingPofHandler ( WriteBuffer::BufferOutput::Handle  hOut  )  [protected]

Construct a Writing POF Handler that will write a POF stream to the passed BufferOutput object.

Parameters:
hOut  the BufferOutput to write to
Returns:
the new WritingPofHandler

Member Function Documentation

virtual bool isSkippable (  )  const [protected, virtual]

Determine if the value encoding can be skipped.

A value can be skipped if it is a default value and if it does not have an identity and if it is in a sparse data structure.

Returns:
true iff value encoding of default values can be skipped altogether

virtual bool isCompressable (  )  const [protected, virtual]

Determine if the value encoding can be compressed by combining type and value information in such a way that type information could be lost.

Returns:
true iff values can be encoded without type information

virtual void encodePosition ( int32_t  iPos  )  [protected, virtual]

Called for each and every value going into the POF stream, in case the value needs its position to be encoded into the stream.

Parameters:
iPos  the position (property index, array index, etc.)

virtual bool isTypeIdEncoded ( int32_t  nTypeId  )  const [protected, virtual]

Determine if the type should be encoded for the current value.

Parameters:
nTypeId  the type of the current value
Returns:
true if the type ID should be placed into the POF stream, and false if only the value itself should be placed into the stream

virtual WriteBuffer::BufferOutput::Handle getBufferOutput (  )  [virtual]

Obtain the DataOutput object that this Writing POF Handler is writing to.

Returns:
the DataOutput object that this POF handler is writing to

virtual WriteBuffer::BufferOutput::View getBufferOutput (  )  const [virtual]

Obtain the DataOutput object that this Writing POF Handler is writing to.

Returns:
the DataOutput object that this POF handler is writing to

virtual Complex::Handle getComplex (  )  [virtual]

Obtain the current Complex object that represents the complex type that is being written to the POF stream.

Returns:
the current Complex object

virtual Complex::View getComplex (  )  const [virtual]

Obtain the current Complex object that represents the complex type that is being written to the POF stream.

Returns:
the current Complex object

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