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

PdxInstance provides run time access to the fields of a PDX without deserializing the PDX. More...

Inherits apache::geode::client::PdxSerializable.

Inherited by apache::geode::client::WritablePdxInstance.

Public Member Functions

virtual int32_t classId () const
 return the classId of the instance being serialized. More...
 
virtual WritablePdxInstancePtr createWriter ()=0
 Creates and returns a WritablePdxInstance whose initial values are those of this PdxInstance. More...
 
virtual int8_t DSFID () const
 return the Data Serialization Fixed ID type. More...
 
virtual SerializablefromData (DataInput &input)
 deserialize this object, typical implementation should return the 'this' pointer. More...
 
virtual void fromData (PdxReaderPtr input)=0
 Deserialize this object. More...
 
virtual const char * getClassName () const =0
 Return the full name of the class that this pdx instance represents. More...
 
virtual void getField (const char *fieldname, CacheablePtr &value) const =0
 Reads the named field and set its value in CacheablePtr type out param. More...
 
virtual void getField (const char *fieldname, bool &value) const =0
 Reads the named field and set its value in bool type out param. More...
 
virtual void getField (const char *fieldname, signed char &value) const =0
 Reads the named field and set its value in signed char type out param. More...
 
virtual void getField (const char *fieldname, unsigned char &value) const =0
 Reads the named field and set its value in unsigned char type out param. More...
 
virtual void getField (const char *fieldname, int16_t &value) const =0
 Reads the named field and set its value in int16_t type out param. More...
 
virtual void getField (const char *fieldname, int32_t &value) const =0
 Reads the named field and set its value in int32_t type out param. More...
 
virtual void getField (const char *fieldname, int64_t &value) const =0
 Reads the named field and set its value in int64_t type out param. More...
 
virtual void getField (const char *fieldname, float &value) const =0
 Reads the named field and set its value in float type out param. More...
 
virtual void getField (const char *fieldname, double &value) const =0
 Reads the named field and set its value in double type out param. More...
 
virtual void getField (const char *fieldName, wchar_t &value) const =0
 Reads the named field and set its value in wchar_t type out param. More...
 
virtual void getField (const char *fieldName, char &value) const =0
 Reads the named field and set its value in char type out param. More...
 
virtual void getField (const char *fieldname, bool **value, int32_t &length) const =0
 Reads the named field and set its value in bool array type out param. More...
 
virtual void getField (const char *fieldname, signed char **value, int32_t &length) const =0
 Reads the named field and set its value in signed char array type out param. More...
 
virtual void getField (const char *fieldname, unsigned char **value, int32_t &length) const =0
 Reads the named field and set its value in unsigned char array type out param. More...
 
virtual void getField (const char *fieldname, int16_t **value, int32_t &length) const =0
 Reads the named field and set its value in int16_t array type out param. More...
 
virtual void getField (const char *fieldname, int32_t **value, int32_t &length) const =0
 Reads the named field and set its value in int32_t array type out param. More...
 
virtual void getField (const char *fieldname, int64_t **value, int32_t &length) const =0
 Reads the named field and set its value in int64_t array type out param. More...
 
virtual void getField (const char *fieldname, float **value, int32_t &length) const =0
 Reads the named field and set its value in float array type out param. More...
 
virtual void getField (const char *fieldname, double **value, int32_t &length) const =0
 Reads the named field and set its value in double array type out param. More...
 
virtual void getField (const char *fieldName, wchar_t **value, int32_t &length) const =0
 Reads the named field and set its value in wchar_t array type out param. More...
 
virtual void getField (const char *fieldName, char **value, int32_t &length) const =0
 Reads the named field and set its value in char array type out param. More...
 
virtual void getField (const char *fieldname, wchar_t **value) const =0
 Reads the named field and set its value in wchar_t* type out param. More...
 
virtual void getField (const char *fieldname, char **value) const =0
 Reads the named field and set its value in char* type out param. More...
 
virtual void getField (const char *fieldname, wchar_t ***value, int32_t &length) const =0
 Reads the named field and set its value in wchar_t* array type out param. More...
 
virtual void getField (const char *fieldname, char ***value, int32_t &length) const =0
 Reads the named field and set its value in char* array type out param. More...
 
virtual void getField (const char *fieldname, CacheableDatePtr &value) const =0
 Reads the named field and set its value in CacheableDatePtr type out param. More...
 
virtual void getField (const char *fieldName, int8_t ***value, int32_t &arrayLength, int32_t *&elementLength) const =0
 Reads the named field and set its value in array of byte arrays type out param. More...
 
virtual void getField (const char *fieldname, CacheableObjectArrayPtr &value) const =0
 Reads the named field and set its value in CacheableObjectArrayPtr type out param. More...
 
virtual CacheableStringArrayPtr getFieldNames ()=0
 Return an unmodifiable list of the field names on this PdxInstance. More...
 
virtual PdxFieldTypes::PdxFieldType getFieldType (const char *fieldname) const =0
 Return the type. More...
 
virtual PdxSerializablePtr getObject ()=0
 Deserializes and returns the domain object that this instance represents. More...
 
virtual bool hasField (const char *fieldname)=0
 Checks if the named field exists and returns the result. More...
 
virtual int32_t hashcode () const =0
 Generates a hashcode based on the identity fields of this PdxInstance. More...
 
virtual bool isIdentityField (const char *fieldname)=0
 Checks if the named field was PdxWriter#markIdentityFieldmarked as an identity field. More...
 
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 =0
 
virtual bool operator== (const CacheableKey &other) const =0
 Returns true if the given CacheableKey derived object is equals to this instance. More...
 
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 void toData (PdxWriterPtr output)=0
 serialize this object in geode PDX format. More...
 
virtual CacheableStringPtr toString () const =0
 Prints out all of the identity fields of this PdxInstance. More...
 
virtual int8_t typeId () const
 return the typeId byte of the instance being serialized. More...
 
virtual ~PdxInstance ()
 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 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...
 

Protected Member Functions

 PdxInstance ()
 constructors More...
 

Detailed Description

PdxInstance provides run time access to the fields of a PDX without deserializing the PDX.

Preventing deserialization saves time and memory. The PdxInstance implementation is a light weight wrapper that simply refers to the raw bytes of the PDX that are kept in the cache. Applications can choose to access PdxInstances instead of C++ objects by configuring the Cache to prefer PDX instances during deserialization. This can be done in cache.xml by setting the attribute read-serialized to true on the pdx element. Or it can be done programmatically using setPdxReadSerialized method. Once this preference is configured, then any time deserialization of a PDX is done it will deserialize into a PdxInstance. PdxInstance are immutable. If you want to change one call createWriter.

Constructor & Destructor Documentation

virtual apache::geode::client::PdxInstance::~PdxInstance ( )
inlinevirtual

destructor

apache::geode::client::PdxInstance::PdxInstance ( )
inlineprotected

constructors

Member Function Documentation

virtual int32_t apache::geode::client::PdxSerializable::classId ( ) const
inlinevirtualinherited

return the classId of the instance being serialized.

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

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.

virtual WritablePdxInstancePtr apache::geode::client::PdxInstance::createWriter ( )
pure virtual

Creates and returns a WritablePdxInstance whose initial values are those of this PdxInstance.

This call returns a copy of the current field values so modifications made to the returned value will not modify this PdxInstance.

Returns
a WritablePdxInstance
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::PdxInstance::fromData ( DataInput input)
inlinevirtual

deserialize this object, typical implementation should return the 'this' pointer.

This is an internal method.

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

virtual void apache::geode::client::PdxInstance::fromData ( PdxReaderPtr  input)
pure virtual

Deserialize this object.

This is an internal method.

Parameters
PdxReaderto Deserialize the PDX object
virtual const char* apache::geode::client::PdxInstance::getClassName ( ) const
pure virtual

Return the full name of the class that this pdx instance represents.

Returns
the name of the class that this pdx instance represents.
Exceptions
IllegalStateExceptionif the PdxInstance typeid is not defined yet, to get classname or if PdxType is not defined for PdxInstance.
virtual void apache::geode::client::PdxInstance::getField ( const char *  fieldname,
CacheablePtr value 
) const
pure virtual

Reads the named field and set its value in CacheablePtr type out param.

CacheablePtr type is corresponding to java object type.

Parameters
fieldnamename of the field to read
valuevalue of the field to be set with CacheablePtr type.
Exceptions
IllegalStateExceptionif PdxInstance doesn't has the named field. For deserialization C++ Native Client requires the domain class to be registered.
See also
Serializable::registerPdxType
PdxInstance::hasField
virtual void apache::geode::client::PdxInstance::getField ( const char *  fieldname,
bool &  value 
) const
pure virtual

Reads the named field and set its value in bool type out param.

bool type is corresponding to java boolean type.

Parameters
fieldnamename of the field to read
valuevalue of the field to be set with bool type.
Exceptions
IllegalStateExceptionif PdxInstance doesn't has the named field.
See also
PdxInstance::hasField
virtual void apache::geode::client::PdxInstance::getField ( const char *  fieldname,
signed char &  value 
) const
pure virtual

Reads the named field and set its value in signed char type out param.

signed char type is corresponding to java byte type. For C++ on Windows and Linux, signed char type is corresponding to int8_t type. However C++ users on Solaris should always use this api after casting int8_t to signed char.

Parameters
fieldnamename of the field to read
valuevalue of the field to be set with signed char type.
Exceptions
IllegalStateExceptionif PdxInstance doesn't has the named field.
See also
PdxInstance::hasField
virtual void apache::geode::client::PdxInstance::getField ( const char *  fieldname,
unsigned char &  value 
) const
pure virtual

Reads the named field and set its value in unsigned char type out param.

unsigned char type is corresponding to java byte type. For C++ on Windows and Linux, unsigned char type is corresponding to int8_t type. However C++ users on Solaris should always use this api after casting int8_t to unsigned char.

Parameters
fieldnamename of the field to read
valuevalue of the field to be set with unsigned char type.
Exceptions
IllegalStateExceptionif PdxInstance doesn't has the named field.
See also
PdxInstance::hasField
virtual void apache::geode::client::PdxInstance::getField ( const char *  fieldname,
int16_t &  value 
) const
pure virtual

Reads the named field and set its value in int16_t type out param.

int16_t type is corresponding to java short type.

Parameters
fieldnamename of the field to read
valuevalue of the field to be set with int16_t type.
Exceptions
IllegalStateExceptionif PdxInstance doesn't has the named field.
See also
PdxInstance::hasField
virtual void apache::geode::client::PdxInstance::getField ( const char *  fieldname,
int32_t &  value 
) const
pure virtual

Reads the named field and set its value in int32_t type out param.

int32_t type is corresponding to java int type.

Parameters
fieldnamename of the field to read
valuevalue of the field to be set with int32_t type.
Exceptions
IllegalStateExceptionif PdxInstance doesn't has the named field.
virtual void apache::geode::client::PdxInstance::getField ( const char *  fieldname,
int64_t &  value 
) const
pure virtual

Reads the named field and set its value in int64_t type out param.

int64_t type is corresponding to java long type.

Parameters
fieldnamename of the field to read
valuevalue of the field to be set with int64_t type.
Exceptions
IllegalStateExceptionif PdxInstance doesn't has the named field.
See also
PdxInstance::hasField
virtual void apache::geode::client::PdxInstance::getField ( const char *  fieldname,
float &  value 
) const
pure virtual

Reads the named field and set its value in float type out param.

float type is corresponding to java float type.

Parameters
fieldnamename of the field to read
valuevalue of the field to be set with float type.
Exceptions
IllegalStateExceptionif PdxInstance doesn't has the named field.
See also
PdxInstance::hasField
virtual void apache::geode::client::PdxInstance::getField ( const char *  fieldname,
double &  value 
) const
pure virtual

Reads the named field and set its value in double type out param.

double type is corresponding to java double type.

Parameters
fieldnamename of the field to read
valuevalue of the field to be set with double type.
Exceptions
IllegalStateExceptionif PdxInstance doesn't has the named field.
See also
PdxInstance::hasField
virtual void apache::geode::client::PdxInstance::getField ( const char *  fieldName,
wchar_t &  value 
) const
pure virtual

Reads the named field and set its value in wchar_t type out param.

wchar_t type is corresponding to java char type.

Parameters
fieldnamename of the field to read
valuevalue of the field to be set with wchar_t type.
Exceptions
IllegalStateExceptionif PdxInstance doesn't has the named field.
See also
PdxInstance::hasField
virtual void apache::geode::client::PdxInstance::getField ( const char *  fieldName,
char &  value 
) const
pure virtual

Reads the named field and set its value in char type out param.

char type is corresponding to java char type.

Parameters
fieldnamename of the field to read
valuevalue of the field to be set with char type.
Exceptions
IllegalStateExceptionif PdxInstance doesn't has the named field.
See also
PdxInstance::hasField
virtual void apache::geode::client::PdxInstance::getField ( const char *  fieldname,
bool **  value,
int32_t &  length 
) const
pure virtual

Reads the named field and set its value in bool array type out param.

bool* type is corresponding to java boolean[] type.

Parameters
fieldnamename of the field to read
valuevalue of the field to be set with bool array type.
lengthlength is set with number of bool elements.
Exceptions
IllegalStateExceptionif PdxInstance doesn't has the named field.
See also
PdxInstance::hasField
virtual void apache::geode::client::PdxInstance::getField ( const char *  fieldname,
signed char **  value,
int32_t &  length 
) const
pure virtual

Reads the named field and set its value in signed char array type out param.

signed char* type is corresponding to java byte[] type. For C++ on Windows and Linux, signed char* type is corresponding to int8_t* type. However C++ users on Solaris should always use this api after casting int8_t* to signed char*.

Parameters
fieldnamename of the field to read
valuevalue of the field to be set with signed char array type.
lengthlength is set with number of signed char elements.
Exceptions
IllegalStateExceptionif PdxInstance doesn't has the named field.
See also
PdxInstance::hasField
virtual void apache::geode::client::PdxInstance::getField ( const char *  fieldname,
unsigned char **  value,
int32_t &  length 
) const
pure virtual

Reads the named field and set its value in unsigned char array type out param.

unsigned char* type is corresponding to java byte[] type. For C++ on Windows and Linux, unsigned char* type is corresponding to int8_t* type. However C++ users on Solaris should always use this api after casting int8_t* to unsigned char*.

Parameters
fieldnamename of the field to read
valuevalue of the field to be set with unsigned char array type.
lengthlength is set with number of unsigned char elements.
Exceptions
IllegalStateExceptionif PdxInstance doesn't has the named field.
See also
PdxInstance::hasField
virtual void apache::geode::client::PdxInstance::getField ( const char *  fieldname,
int16_t **  value,
int32_t &  length 
) const
pure virtual

Reads the named field and set its value in int16_t array type out param.

int16_t* type is corresponding to java short[] type.

Parameters
fieldnamename of the field to read
valuevalue of the field to be set with int16_t array type.
lengthlength is set with number of int16_t elements.
Exceptions
IllegalStateExceptionif PdxInstance doesn't has the named field.
See also
PdxInstance::hasField
virtual void apache::geode::client::PdxInstance::getField ( const char *  fieldname,
int32_t **  value,
int32_t &  length 
) const
pure virtual

Reads the named field and set its value in int32_t array type out param.

int32_t* type is corresponding to java int[] type.

Parameters
fieldnamename of the field to read
valuevalue of the field to be set with int32_t array type.
lengthlength is set with number of int32_t elements.
Exceptions
IllegalStateExceptionif PdxInstance doesn't has the named field.
See also
PdxInstance::hasField
virtual void apache::geode::client::PdxInstance::getField ( const char *  fieldname,
int64_t **  value,
int32_t &  length 
) const
pure virtual

Reads the named field and set its value in int64_t array type out param.

int64_t* type is corresponding to java long[] type.

Parameters
fieldnamename of the field to read
valuevalue of the field to be set with int64_t array type.
lengthlength is set with number of int64_t elements.
Exceptions
IllegalStateExceptionif PdxInstance doesn't has the named field.
See also
PdxInstance::hasField
virtual void apache::geode::client::PdxInstance::getField ( const char *  fieldname,
float **  value,
int32_t &  length 
) const
pure virtual

Reads the named field and set its value in float array type out param.

float* type is corresponding to java float[] type.

Parameters
fieldnamename of the field to read
valuevalue of the field to be set with float array type.
lengthlength is set with number of float elements.
Exceptions
IllegalStateExceptionif PdxInstance doesn't has the named field.
See also
PdxInstance::hasField
virtual void apache::geode::client::PdxInstance::getField ( const char *  fieldname,
double **  value,
int32_t &  length 
) const
pure virtual

Reads the named field and set its value in double array type out param.

double* type is corresponding to java double[] type.

Parameters
fieldnamename of the field to read
valuevalue of the field to be set with double array type.
lengthlength is set with number of double elements.
Exceptions
IllegalStateExceptionif PdxInstance doesn't has the named field.
See also
PdxInstance::hasField
virtual void apache::geode::client::PdxInstance::getField ( const char *  fieldName,
wchar_t **  value,
int32_t &  length 
) const
pure virtual

Reads the named field and set its value in wchar_t array type out param.

wchar_t* type is corresponding to java String type.

Parameters
fieldnamename of the field to read
valuevalue of the field to be set with wchar_t array type.
lengthlength is set with number of wchar_t* elements.
Exceptions
IllegalStateExceptionif PdxInstance doesn't has the named field.
See also
PdxInstance::hasField
virtual void apache::geode::client::PdxInstance::getField ( const char *  fieldName,
char **  value,
int32_t &  length 
) const
pure virtual

Reads the named field and set its value in char array type out param.

char* type is corresponding to java String type.

Parameters
fieldnamename of the field to read
valuevalue of the field to be set with char array type.
lengthlength is set with number of char* elements.
Exceptions
IllegalStateExceptionif PdxInstance doesn't has the named field.
See also
PdxInstance::hasField
virtual void apache::geode::client::PdxInstance::getField ( const char *  fieldname,
wchar_t **  value 
) const
pure virtual

Reads the named field and set its value in wchar_t* type out param.

wchar_t* type is corresponding to java String type.

Parameters
fieldnamename of the field to read
valuevalue of the field to be set with wchar_t type.
Exceptions
IllegalStateExceptionif PdxInstance doesn't has the named field.
See also
PdxInstance::hasField
virtual void apache::geode::client::PdxInstance::getField ( const char *  fieldname,
char **  value 
) const
pure virtual

Reads the named field and set its value in char* type out param.

char* type is corresponding to java String type.

Parameters
fieldnamename of the field to read
valuevalue of the field to be set with char* type.
Exceptions
IllegalStateExceptionif PdxInstance doesn't has the named field.
See also
PdxInstance::hasField
virtual void apache::geode::client::PdxInstance::getField ( const char *  fieldname,
wchar_t ***  value,
int32_t &  length 
) const
pure virtual

Reads the named field and set its value in wchar_t* array type out param.

wchar_t** type is corresponding to java String[] type.

Parameters
fieldnamename of the field to read
valuevalue of the field to be set with wchar_t* array type.
lengthlength is set with number of wchar_t** elements.
Exceptions
IllegalStateExceptionif PdxInstance doesn't has the named field.
See also
PdxInstance::hasField
virtual void apache::geode::client::PdxInstance::getField ( const char *  fieldname,
char ***  value,
int32_t &  length 
) const
pure virtual

Reads the named field and set its value in char* array type out param.

char** type is corresponding to java String[] type.

Parameters
fieldnamename of the field to read
valuevalue of the field to be set with char* array type.
lengthlength is set with number of char** elements.
Exceptions
IllegalStateExceptionif PdxInstance doesn't has the named field.
See also
PdxInstance::hasField
virtual void apache::geode::client::PdxInstance::getField ( const char *  fieldname,
CacheableDatePtr value 
) const
pure virtual

Reads the named field and set its value in CacheableDatePtr type out param.

CacheableDatePtr type is corresponding to java Java.util.date type.

Parameters
fieldnamename of the field to read
valuevalue of the field to be set with CacheableDatePtr type.
Exceptions
IllegalStateExceptionif PdxInstance doesn't has the named field.
See also
PdxInstance::hasField
virtual void apache::geode::client::PdxInstance::getField ( const char *  fieldName,
int8_t ***  value,
int32_t &  arrayLength,
int32_t *&  elementLength 
) const
pure virtual

Reads the named field and set its value in array of byte arrays type out param.

int8_t** type is corresponding to java byte[][] type.

Parameters
fieldnamename of the field to read.
valuevalue of the field to be set with array of byte arrays type.
arrayLengtharrayLength is set to the number of byte arrays.
elementLengthelementLength is set to individual byte array lengths.
Exceptions
IllegalStateExceptionif PdxInstance doesn't has the named field.
See also
PdxInstance::hasField
virtual void apache::geode::client::PdxInstance::getField ( const char *  fieldname,
CacheableObjectArrayPtr value 
) const
pure virtual

Reads the named field and set its value in CacheableObjectArrayPtr type out param.

For deserialization C++ Native Client requires the domain class to be registered. CacheableObjectArrayPtr type is corresponding to java Object[] type.

Parameters
fieldnamename of the field to read.
valuevalue of the field to be set with CacheableObjectArrayPtr type.
Exceptions
IllegalStateExceptionif PdxInstance doesn't has the named field.
See also
Serializable::registerPdxType
PdxInstance::hasField
virtual CacheableStringArrayPtr apache::geode::client::PdxInstance::getFieldNames ( )
pure virtual

Return an unmodifiable list of the field names on this PdxInstance.

Returns
an unmodifiable list of the field names on this PdxInstance
virtual PdxFieldTypes::PdxFieldType apache::geode::client::PdxInstance::getFieldType ( const char *  fieldname) const
pure virtual

Return the type.

See also
PdxInstance::PdxFieldTypes of the field in the pdx instance.
Returns
the type
See also
PdxInstance::PdxFieldTypes of the field in the pdx instance.
Exceptions
IllegalStateExceptionif the PdxInstance typeid is not defined yet, to get classname or if PdxType is not defined for PdxInstance.
virtual PdxSerializablePtr apache::geode::client::PdxInstance::getObject ( )
pure virtual

Deserializes and returns the domain object that this instance represents.

For deserialization C++ Native Client requires the domain class to be registered.

Returns
the deserialized domain object.
See also
Serializable::registerPdxType
virtual bool apache::geode::client::PdxInstance::hasField ( const char *  fieldname)
pure virtual

Checks if the named field exists and returns the result.

This can be useful when writing code that handles more than one version of a PDX class.

Parameters
fieldnamethe name of the field to check
Returns
true if the named field exists; otherwise false
virtual int32_t apache::geode::client::PdxInstance::hashcode ( ) const
pure virtual

Generates a hashcode based on the identity fields of this PdxInstance.

If a PdxInstance has marked identity fields using PdxWriter#markIdentityField then only the marked identity fields are its identity fields. Otherwise all its fields are identity fields.

For deserialization C++ Native Client requires the domain class to be registered. If the field is an array then all array elements are used for hashcode computation. Otherwise the raw bytes of its value are used to compute the hash code.

Exceptions
IllegalStateExceptionif the field contains an element that is not of CacheableKey derived type.
See also
Serializable::registerPdxType

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

virtual bool apache::geode::client::PdxInstance::isIdentityField ( const char *  fieldname)
pure virtual

Checks if the named field was PdxWriter#markIdentityFieldmarked as an identity field.

Note that if no fields have been marked then all the fields are used as identity fields even though this method will return false since none of them have been marked.

Parameters
fieldnamethe name of the field to check
Returns
true if the named field exists and was marked as an identify field; otherwise false
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::PdxInstance::objectSize ( ) const
pure virtual
Returns
the size of the object in bytes This is an internal method. It is used in case of heap LRU property is set.

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

virtual bool apache::geode::client::PdxInstance::operator== ( const CacheableKey other) const
pure virtual

Returns true if the given CacheableKey derived object is equals to this instance.

If other is not a PdxInstance then it is not equal to this instance. NOTE: Even if other is the result of calling getObject() it will not be equal to this instance

.

Otherwise equality of two PdxInstances is determined as follows:

  1. The domain class name must be equal for both PdxInstances
  2. Each identity field must be equal.

If one of the instances does not have a field that the other one does then equals will assume it has the field with a default value. If a PdxInstance has marked identity fields using markIdentityField then only the marked identity fields are its identity fields. Otherwise all its fields are identity fields.

An identity field is equal if all the following are true:

  1. The field name is equal.
  2. The field type is equal.
  3. The field value is equal.

If an identity field is of type derived from Cacheable then it is deserialized. For deserialization C++ Native Client requires the domain class to be registered. If the deserialized object is an array then all array elements are used to determine equality. If an identity field is of type CacheableObjectArray then it is deserialized and all array elements are used to determine equality. For all other field types the value does not need to be deserialized. Instead the serialized raw bytes are compared and used to determine equality.

Parameters
otherthe other instance to compare to this.
Returns
true if this instance is equal to other.
Exceptions
IllegalStateExceptionif the field contains an element that is not of CacheableKey derived type.
See also
Serializable::registerPdxType

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::PdxInstance::toData ( DataOutput output) const
inlinevirtual

serialize this object.

This is an internal method.

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

virtual void apache::geode::client::PdxInstance::toData ( PdxWriterPtr  output)
pure virtual

serialize this object in geode PDX format.

This is an internal method.

Parameters
PdxWriterto serialize the PDX object
virtual CacheableStringPtr apache::geode::client::PdxInstance::toString ( ) const
pure virtual

Prints out all of the identity fields of this PdxInstance.

If a PdxInstance has marked identity fields using PdxWriter#markIdentityField then only the marked identity fields are its identity fields. Otherwise all its fields are identity fields

. For deserialization C++ Native Client requires the domain class to be registered.

See also
Serializable::registerPdxType

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

virtual int8_t apache::geode::client::PdxSerializable::typeId ( ) const
virtualinherited

return the typeId byte of the instance being serialized.

This is used by deserialization 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.


Pivotal GemFire C++ Cache API Documentation