Oracle Coherence for C++ API
Release 3.6.1.0

E18813-01

SimplePofContext Class Reference

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

Inherits Object, and PofContext.

Inherited by SystemPofContext.

List of all members.


Detailed Description

Basic PofContext implementation.
Author:
gm 2008.10.24
See also:
PortableObjectSerializer

Public Types

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

Public Member Functions

virtual void  registerUserType (int32_t nTypeId, Class::View vClass, PofSerializer::View vSerializer)
  Associate a user type with a type identifier and PofSerializer.
virtual void  unregisterUserType (int32_t nTypeId)
  Unregister a user type previously registered using the specified type identifier.
virtual
PofSerializer::View 
getPofSerializer (int32_t nTypeId) const
  Return a PofSerializer that can be used to serialize and deserialize an objectof the specified user type to and from a POF stream.
Parameters:
nTypeId  the type identifier of the user type that can be serialized and deserialized using the returned PofSerializer
Returns:
a PofSerializer for the specified user type
Exceptions:
coherence::lang::IllegalArgumentException  if the specified user type is negative or unknown to this PofContext

virtual int32_t  getUserTypeIdentifier (Object::View v) const
  Determine the user type identifier associated with the given object.
Parameters:
v  an instance of a user type; must not be NULL
Returns:
the type identifier of the user type associated with the given object
Exceptions:
coherence::lang::IllegalArgumentException  if the user type associated with the given object is unknown to this PofContext or if the object is NULL

virtual int32_t  getUserTypeIdentifier (Class::View vClass) const
  Determine the user type identifier associated with the given class.
Parameters:
vClass  a user type class; must not be NULL
Returns:
the type identifier of the user type associated with the given class
Exceptions:
coherence::lang::IllegalArgumentException  if the user type associated with the given class is unknown to this PofContext or if the class is NULL

virtual int32_t  getUserTypeIdentifier (String::View vsClass) const
  Determine the user type identifier associated with the given class name.
Parameters:
vsClass  the name of a user type class; must not be NULL
Returns:
the type identifier of the user type associated with the given class name
Exceptions:
coherence::lang::IllegalArgumentException  if the user type associated with the given class name is unknown to this PofContext or if the class name is NULL

virtual String::View  getClassName (int32_t nTypeId) const
  Determine the name of the class associated with the given user type identifier.
Parameters:
nTypeId  the user type identifier; must be non-negative
Returns:
the name of the class associated with the specified user type identifier
Exceptions:
coherence::lang::IllegalArgumentException  if the specified user type is negative or unknown to this PofContext

virtual Class::View  getClass (int32_t nTypeId) const
  Determine the class associated with the given user type identifier.
Parameters:
nTypeId  the user type identifier; must be non-negative
Returns:
the class associated with the specified user type identifier
Exceptions:
coherence::lang::IllegalArgumentException  if the specified user type is negative or unknown to this PofContext

virtual bool  isUserType (Object::View v) const
  Determine if the given object is an instance of a user type known to this PofContext.
Parameters:
v  the object to test; must not be NULL
Returns:
true iff the specified object is of a valid user type
Exceptions:
coherence::lang::IllegalArgumentException  if the given object is NULL

virtual bool  isUserType (Class::View vClass) const
  Determine if the given class is a user type known to this PofContext.
Parameters:
vClass  the class to test; must not be NULL
Returns:
true iff the specified class is a valid user type known to this PofContext
Exceptions:
coherence::lang::IllegalArgumentException  if the given class is NULL

virtual bool  isUserType (String::View vsClass) const
  Determine if the class with the given name is a user type known to this PofContext.
Parameters:
vsClass  the name of the class to test; must not be NULL
Returns:
true iff the class with the specified name is a valid user type
Exceptions:
coherence::lang::IllegalArgumentException  if the given class name is NULL

virtual void  serialize (WriteBuffer::BufferOutput::Handle hOut, Object::View v) const
  Serialize an object to a WriteBuffer by writing its state using the specified BufferOutput object.
Parameters:
hOut  the BufferOutput with which to write the object's state
v  the object to serialize
virtual void IOException if an I/O error occurs
virtual Object::Holder  deserialize (ReadBuffer::BufferInput::Handle hIn) const
  Deserialize an object from a ReadBuffer by reading its state using the specified BufferInput object.
Parameters:
hIn  the BufferInput with which to read the object's state
Returns:
the deserialized user type instance
virtual void IOException if an I/O error occurs
virtual void  toStream (std::ostream &out) const
  Output a human-readable description of this Object to the given stream.

coherence::lang::operator<<(std::ostream, Object::View) is defined and will call into the toStream method, to output Objects. If a managed String object is desired, the COH_TO_STRING macro can be used to build up a String from streamable contents.

 Object::View vKey   = ...
 Object::View vValue = ...
 std::cout << vKey << " = " << vValue << std::endl;

 String::Handle hs = COH_TO_STRING(vKey << " = " << vValue);
Parameters:
out  the stream used to output the description


Protected Member Functions

virtual void  validateTypeId (int32_t nTypeId) const
  Ensure that the given user type identifier is valid.

Protected Attributes

FinalHandle< LongArray m_hlaClass
  A LongArray of user types, indexed by type identifier.
FinalHandle< LongArray m_hlaSerializer
  A LongArray of PofSerializer objects, indexed by type identifier.
FinalHandle< Map m_hMapClassName
  A Map that contains mappings from a registered class name to type identifier.
FinalHandle< ThreadGate m_hGate
  ThreadGate used to synchronize access to this PofContext.

Member Function Documentation

virtual void registerUserType ( int32_t  nTypeId,
Class::View  vClass,
PofSerializer::View  vSerializer  
) [virtual]

Associate a user type with a type identifier and PofSerializer.

Parameters:
nTypeId  the type identifier of the specified user type; must be greater or equal to 0
vClass  the user type to register with this PofContext; must not be NULL
vSerializer  the PofSerializer that will be used to serialize and deserialize objects of the specified class; must not be NULL
Exceptions:
coherence::lang::IllegalArgumentException  on invalid type identifer, class, or PofSerializer

virtual void unregisterUserType ( int32_t  nTypeId  )  [virtual]

Unregister a user type previously registered using the specified type identifier.

Parameters:
nTypeId  the type identifier of the user type to unregister
Exceptions:
coherence::lang::IllegalArgumentException  if the specified user type identifier is unknown to this PofContext

virtual void validateTypeId ( int32_t  nTypeId  )  const [protected, virtual]

Ensure that the given user type identifier is valid.

Parameters:
nTypeId  the user type identifier to validate
Exceptions:
coherence::lang::IllegalArgumentException  if the given user type identifier is negative

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