#include <coherence/io/pof/SimplePofContext.hpp>
Inherits Object, and PofContext.
Inherited by SystemPofContext.
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.
| |||||||
| virtual int32_t | getUserTypeIdentifier (Object::View v) const | ||||||
| Determine the user type identifier associated with the given object.
| |||||||
| virtual int32_t | getUserTypeIdentifier (Class::View vClass) const | ||||||
| Determine the user type identifier associated with the given class.
| |||||||
| virtual int32_t | getUserTypeIdentifier (String::View vsClass) const | ||||||
| Determine the user type identifier associated with the given class name.
| |||||||
| virtual String::View | getClassName (int32_t nTypeId) const | ||||||
| Determine the name of the class associated with the given user type identifier.
| |||||||
| virtual Class::View | getClass (int32_t nTypeId) const | ||||||
| Determine the class associated with the given user type identifier.
| |||||||
| virtual bool | isUserType (Object::View v) const | ||||||
| Determine if the given object is an instance of a user type known to this PofContext.
| |||||||
| virtual bool | isUserType (Class::View vClass) const | ||||||
| Determine if the given class is a user type known to this PofContext.
| |||||||
| virtual bool | isUserType (String::View vsClass) const | ||||||
| Determine if the class with the given name is a user type known to this PofContext.
| |||||||
| 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.
| |||||||
| virtual Object::Holder | deserialize (ReadBuffer::BufferInput::Handle hIn) const | ||||||
| Deserialize an object from a ReadBuffer by reading its state using the specified BufferInput object.
| |||||||
|
virtual TypedHandle < const String > | toString () const | ||||||
| Output a human-readable description of this Object to the given stream. Note that when overriding this method the return type must be TypedHandle<const String> rather then String::View. These two types are assignment compatible but not equivalent and declaring the override with String::View will not be a compatible override. coherence::lang::operator<<(std::ostream, Object::View) is defined and will call into the toString 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 and is generally how toString() will be implemented.
Object::View vKey = ... Object::View vValue = ... std::cout << vKey << " = " << vValue << std::endl; String::View vs = COH_TO_STRING(vKey << " = " << vValue); The COH_TO_STRING macro is also the most common way to implement the toString method. For example:
virtual TypedHandle<const String> Person::toString() const { return COH_TO_STRING("Name: " << f_sName << " SSN: " << f_nSSN); }
| |||||||
| virtual bool | isReferenceEnabled () const | ||||||
| Determine if Identity/Reference type support is enabled for this SimplePofContext. | |||||||
| virtual void | setReferenceEnabled (bool fEnabled) | ||||||
| Enable or disable POF Identity/Reference type support for this SimplePofContext. | |||||||
| virtual void | setReferenceEnabled (bool fEnabled) const | ||||||
| Enable or disable POF Identity/Reference type support for this SimplePofContext. | |||||||
Protected Member Functions | |||||||
| SimplePofContext (const SimplePofContext &that) | |||||||
| Copy constructor. | |||||||
| virtual void | validateTypeId (int32_t nTypeId) const | ||||||
| Ensure that the given user type identifier is valid. | |||||||
Protected Attributes | |||||||
| FinalHandle< LongArray > | f_hlaClass | ||||||
| A LongArray of user types, indexed by type identifier. | |||||||
| FinalHandle< LongArray > | f_hlaSerializer | ||||||
| A LongArray of PofSerializer objects, indexed by type identifier. | |||||||
| FinalHandle< Map > | f_hMapClassName | ||||||
| A Map that contains mappings from a registered class name to type identifier. | |||||||
| bool | m_fReferenceEnabled | ||||||
| True if POF Identity/Reference type support is enabled. | |||||||
| virtual void registerUserType | ( | int32_t | nTypeId, | |
| Class::View | vClass, | |||
| PofSerializer::View | vSerializer | |||
| ) | [virtual] |
Associate a user type with a type identifier and PofSerializer.
| 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 |
| 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.
| nTypeId | the type identifier of the user type to unregister |
| 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.
| nTypeId | the user type identifier to validate |
| coherence::lang::IllegalArgumentException | if the given user type identifier is negative |
| virtual bool isReferenceEnabled | ( | ) | const [virtual] |
Determine if Identity/Reference type support is enabled for this SimplePofContext.
| virtual void setReferenceEnabled | ( | bool | fEnabled | ) | [virtual] |
Enable or disable POF Identity/Reference type support for this SimplePofContext.
| fEnabled | true to enable POF Identity/Reference type support; false to disable |
| virtual void setReferenceEnabled | ( | bool | fEnabled | ) | const [virtual] |
Enable or disable POF Identity/Reference type support for this SimplePofContext.
| fEnabled | true to enable POF Identity/Reference type support; false to disable |