VMware GemFire Native C++ Reference  9.1
apache::geode::client::CacheableEnum Class Reference

Since C++ enums cannot be directly passed as a parameter to PdxWriter's writeObject and PdxReader's readObject api wrap C++ enum in to a immutable wrapper CacheableEnum class type by specifying enum class name, enum value name and its ordinal. More...

Inherits apache::geode::client::CacheableKey.

Public Member Functions

virtual int32_t classId () const
 Return the classId of the instance being serialized. More...
 
virtual int8_t DSFID () const
 return the Data Serialization Fixed ID type. More...
 
virtual SerializablefromData (DataInput &input)
 deserialize this object More...
 
const char * getEnumClassName () const
 
const char * getEnumName () const
 
int32_t getEnumOrdinal () const
 
virtual int32_t hashcode () const
 
virtual int32_t logString (char *buffer, int32_t maxLength) const
 Copy the string form of a key into a char* buffer for logging purposes. More...
 
virtual uint32_t objectSize () const
 
virtual bool operator== (const CacheableKey &other) const
 
void preserveSB () const
 Atomically increment reference count. More...
 
int32_t refCount ()
 
void releaseSB () const
 Atomically decrement reference count, the SharedBase object is automatically deleted when its reference count goes to zero. More...
 
virtual void toData (DataOutput &output) const
 serialize this object More...
 
virtual CacheableStringPtr toString () const
 Display this object as c string. More...
 
virtual int8_t typeId () const
 return the typeId byte of the instance being serialized. More...
 
 ~CacheableEnum ()
 Destructor. More...
 

Static Public Member Functions

template<class PRIM >
static CacheableKeyPtr create (const PRIM value)
 Factory method that creates the key type that matches the type of value. More...
 
static CacheableEnumPtr create (const char *enumClassName, const char *enumName, int32_t ordinal)
 Factory method for creating an instance of CacheableEnum. More...
 
static SerializablecreateDeserializable ()
 creation function for enum. More...
 
static void registerPdxSerializer (PdxSerializerPtr pdxSerializer)
 Register the PDX serializer which can handle serialization for instances of user domain classes. More...
 
static void registerPdxType (TypeFactoryMethodPdx creationFunction)
 register an Pdx instance factory method for a given type. More...
 
static void registerType (TypeFactoryMethod creationFunction)
 register an instance factory method for a given type. More...
 

Detailed Description

Since C++ enums cannot be directly passed as a parameter to PdxWriter's writeObject and PdxReader's readObject api wrap C++ enum in to a immutable wrapper CacheableEnum class type by specifying enum class name, enum value name and its ordinal.

C++ enum allows explicit setting of ordinal number, but it is up to the user to map java enumName with that of C++ enumName. Currently this wrapper only works as part of PdxSerializable member object and cannot be directly used in Region operations.

See also
PdxWriter::writeObject
PdxReader::readObject

Constructor & Destructor Documentation

apache::geode::client::CacheableEnum::~CacheableEnum ( )

Destructor.

Member Function Documentation

virtual int32_t apache::geode::client::CacheableEnum::classId ( ) const
inlinevirtual

Return the classId of the instance being serialized.

This is used by deserialization to determine what instance type to create and deserialize into.

Implements apache::geode::client::Serializable.

template<class PRIM >
static CacheableKeyPtr apache::geode::client::CacheableKey::create ( const PRIM  value)
inlinestaticinherited

Factory method that creates the key type that matches the type of value.

For customer defined derivations of CacheableKey, the method apache::geode::client::createKey may be overloaded. For pointer types (e.g. char*) the method apache::geode::client::createKeyArr may be overloaded.

static CacheableEnumPtr apache::geode::client::CacheableEnum::create ( const char *  enumClassName,
const char *  enumName,
int32_t  ordinal 
)
inlinestatic

Factory method for creating an instance of CacheableEnum.

Parameters
classNamethe name of the enum class that maps to the java enum type.
enumNamethe name of the enum constant that maps to the java enum type.
ordinalthe ordinal value of the enum constant that maps to the java enum type.
Returns
a CacheableEnum representing C++ enum.
static Serializable* apache::geode::client::CacheableEnum::createDeserializable ( )
inlinestatic

creation function for enum.

virtual int8_t apache::geode::client::Serializable::DSFID ( ) const
virtualinherited

return the Data Serialization Fixed ID type.

This is used to determine what instance type to create and deserialize into.

Note that this should not be overridden by custom implementations and is reserved only for builtin types.

Reimplemented in apache::geode::client::Struct, and apache::geode::client::CacheableUndefined.

virtual Serializable* apache::geode::client::CacheableEnum::fromData ( DataInput input)
virtual

deserialize this object

Implements apache::geode::client::Serializable.

const char* apache::geode::client::CacheableEnum::getEnumClassName ( ) const
inline
Returns
enum class name.
const char* apache::geode::client::CacheableEnum::getEnumName ( ) const
inline
Returns
enum name.
int32_t apache::geode::client::CacheableEnum::getEnumOrdinal ( ) const
inline
Returns
enum ordinal.
virtual int32_t apache::geode::client::CacheableEnum::hashcode ( ) const
virtual
Returns
the hashcode for this key.

Implements apache::geode::client::CacheableKey.

virtual int32_t apache::geode::client::CacheableKey::logString ( char *  buffer,
int32_t  maxLength 
) const
virtualinherited

Copy the string form of a key into a char* buffer for logging purposes.

Implementations should only generate a string as long as maxLength chars, and return the number of chars written. buffer is expected to be large enough to hold at least maxLength chars.

The default implementation renders the classname and instance address.

Reimplemented in apache::geode::client::CacheableString, apache::geode::client::CacheableDate, and apache::geode::client::CacheableKeyType< TObj, TYPEID, TYPENAME, SPRINTFSYM, STRSIZE >.

virtual uint32_t apache::geode::client::CacheableEnum::objectSize ( ) const
inlinevirtual
Returns
the size of the object in bytes

Reimplemented from apache::geode::client::Serializable.

virtual bool apache::geode::client::CacheableEnum::operator== ( const CacheableKey other) const
virtual
Returns
true if this key matches other.

Implements apache::geode::client::CacheableKey.

void apache::geode::client::SharedBase::preserveSB ( ) const
inherited

Atomically increment reference count.

int32_t apache::geode::client::SharedBase::refCount ( )
inlineinherited
Returns
the reference count
static void apache::geode::client::Serializable::registerPdxSerializer ( PdxSerializerPtr  pdxSerializer)
staticinherited

Register the PDX serializer which can handle serialization for instances of user domain classes.

See also
PdxSerializer
static void apache::geode::client::Serializable::registerPdxType ( TypeFactoryMethodPdx  creationFunction)
staticinherited

register an Pdx instance factory method for a given type.

Exceptions
IllegalStateExceptionif the typeName has already been registered, or there is an error in registering the type; check errno for more information in the latter case.
static void apache::geode::client::Serializable::registerType ( TypeFactoryMethod  creationFunction)
staticinherited

register an instance factory method for a given type.

During registration the factory will be invoked to extract the typeId to associate with this function.

Exceptions
IllegalStateExceptionif the typeId has already been registered, or there is an error in registering the type; check errno for more information in the latter case.
void apache::geode::client::SharedBase::releaseSB ( ) const
inherited

Atomically decrement reference count, the SharedBase object is automatically deleted when its reference count goes to zero.

virtual void apache::geode::client::CacheableEnum::toData ( DataOutput output) const
virtual

serialize this object

Implements apache::geode::client::Serializable.

virtual CacheableStringPtr apache::geode::client::CacheableEnum::toString ( ) const
inlinevirtual

Display this object as c string.

Reimplemented from apache::geode::client::Serializable.

virtual int8_t apache::geode::client::CacheableEnum::typeId ( ) const
inlinevirtual

return the typeId byte of the instance being serialized.

This is used by deserialization to determine what instance type to create and deserialize into.

Reimplemented from apache::geode::client::Serializable.


Pivotal GemFire C++ Cache API Documentation