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

A PdxWriter will be passed to PdxSerializable.toData when it is serializing the domain class. More...

Inherits apache::geode::client::SharedBase.

Public Member Functions

virtual PdxWriterPtr markIdentityField (const char *fieldName)=0
 Indicate that the given field name should be included in hashCode and equals checks of this object on a server that is using CacheFactory#setPdxReadSerialized or when a client executes a query on a server. More...
 
 PdxWriter ()
 constructors 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 PdxWriterPtr writeArrayOfByteArrays (const char *fieldName, int8_t **array, int arrayLength, int *elementLength)=0
 Writes the named field with the given value to the serialized form. More...
 
virtual PdxWriterPtr writeBoolean (const char *fieldName, bool value)=0
 Writes the named field with the given value to the serialized form. More...
 
virtual PdxWriterPtr writeBooleanArray (const char *fieldName, bool *array, int length)=0
 Writes the named field with the given value to the serialized form. More...
 
virtual PdxWriterPtr writeByte (const char *fieldName, int8_t value)=0
 Writes the named field with the given value to the serialized form. More...
 
virtual PdxWriterPtr writeByteArray (const char *fieldName, int8_t *array, int length)=0
 Writes the named field with the given value to the serialized form. More...
 
virtual PdxWriterPtr writeChar (const char *fieldName, char value)=0
 Writes the named field with the given value to the serialized form. More...
 
virtual PdxWriterPtr writeCharArray (const char *fieldName, char *array, int length)=0
 Writes the named field with the given value to the serialized form. More...
 
virtual PdxWriterPtr writeDate (const char *fieldName, CacheableDatePtr date)=0
 Writes the named field with the given value to the serialized form. More...
 
virtual PdxWriterPtr writeDouble (const char *fieldName, double value)=0
 Writes the named field with the given value to the serialized form. More...
 
virtual PdxWriterPtr writeDoubleArray (const char *fieldName, double *array, int length)=0
 Writes the named field with the given value to the serialized form. More...
 
virtual PdxWriterPtr writeFloat (const char *fieldName, float value)=0
 Writes the named field with the given value to the serialized form. More...
 
virtual PdxWriterPtr writeFloatArray (const char *fieldName, float *array, int length)=0
 Writes the named field with the given value to the serialized form. More...
 
virtual PdxWriterPtr writeInt (const char *fieldName, int32_t value)=0
 Writes the named field with the given value to the serialized form. More...
 
virtual PdxWriterPtr writeIntArray (const char *fieldName, int32_t *array, int length)=0
 Writes the named field with the given value to the serialized form. More...
 
virtual PdxWriterPtr writeLong (const char *fieldName, int64_t value)=0
 Writes the named field with the given value to the serialized form. More...
 
virtual PdxWriterPtr writeLongArray (const char *fieldName, int64_t *array, int length)=0
 Writes the named field with the given value to the serialized form. More...
 
virtual PdxWriterPtr writeObject (const char *fieldName, CacheablePtr value)=0
 Writes the named field with the given value to the serialized form. More...
 
virtual PdxWriterPtr writeObjectArray (const char *fieldName, CacheableObjectArrayPtr array)=0
 Writes the named field with the given value to the serialized form. More...
 
virtual PdxWriterPtr writeShort (const char *fieldName, int16_t value)=0
 Writes the named field with the given value to the serialized form. More...
 
virtual PdxWriterPtr writeShortArray (const char *fieldName, int16_t *array, int length)=0
 Writes the named field with the given value to the serialized form. More...
 
virtual PdxWriterPtr writeString (const char *fieldName, const char *value)=0
 Writes the named field with the given value to the serialized form. More...
 
virtual PdxWriterPtr writeStringArray (const char *fieldName, char **array, int length)=0
 Writes the named field with the given value to the serialized form. More...
 
virtual PdxWriterPtr writeUnreadFields (PdxUnreadFieldsPtr unread)=0
 Writes the given unread fields to the serialized form. More...
 
virtual PdxWriterPtr writeWideChar (const char *fieldName, wchar_t value)=0
 Writes the named field with the given value to the serialized form The fields type is wchar_t More...
 
virtual PdxWriterPtr writeWideCharArray (const char *fieldName, wchar_t *array, int length)=0
 Writes the named field with the given value to the serialized form. More...
 
virtual PdxWriterPtr writeWideString (const char *fieldName, const wchar_t *value)=0
 Writes the named field with the given value to the serialized form. More...
 
virtual PdxWriterPtr writeWideStringArray (const char *fieldName, wchar_t **array, int length)=0
 Writes the named field with the given value to the serialized form. More...
 
virtual ~PdxWriter ()
 destructor More...
 

Detailed Description

A PdxWriter will be passed to PdxSerializable.toData when it is serializing the domain class.

The domain class needs to serialize member fields using this abstract class. This class is implemented by Native Client.

Constructor & Destructor Documentation

apache::geode::client::PdxWriter::PdxWriter ( )
inline

constructors

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

destructor

Member Function Documentation

virtual PdxWriterPtr apache::geode::client::PdxWriter::markIdentityField ( const char *  fieldName)
pure virtual

Indicate that the given field name should be included in hashCode and equals checks of this object on a server that is using CacheFactory#setPdxReadSerialized or when a client executes a query on a server.

The fields that are marked as identity fields are used to generate the hashCode and equals methods of PdxInstance. Because of this, the identity fields should themselves either be primitives, or implement hashCode and equals.

If no fields are set as identity fields, then all fields will be used in hashCode and equals checks.

The identity fields should make marked after they are written using a write* method.

Parameters
fieldNamethe name of the field to mark as an identity field.
Returns
this PdxWriterPtr
Exceptions
IllegalStateExceptionif the named field does not exist.
void apache::geode::client::SharedBase::preserveSB ( ) const
inherited

Atomically increment reference count.

int32_t apache::geode::client::SharedBase::refCount ( )
inlineinherited
Returns
the reference count
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 PdxWriterPtr apache::geode::client::PdxWriter::writeArrayOfByteArrays ( const char *  fieldName,
int8_t **  array,
int  arrayLength,
int *  elementLength 
)
pure virtual

Writes the named field with the given value to the serialized form.

The fields type is int8_t**.

C++ int8_t** is mapped to Java byte[][].

Parameters
fieldNamethe name of the field to write
arraythe value of the field to write
arrayLengththe length of the actual byte array field holding individual byte arrays to write
elementLengththe length of the individual byte arrays to write
Returns
this PdxWriter
Exceptions
IllegalStateExceptionif the named field has already been written or fieldName is NULL or empty.
virtual PdxWriterPtr apache::geode::client::PdxWriter::writeBoolean ( const char *  fieldName,
bool  value 
)
pure virtual

Writes the named field with the given value to the serialized form.

The fields type is bool.

C++ bool is mapped to Java boolean

Parameters
fieldNamethe name of the field to write
valuethe value of the field to write
Returns
this PdxWriter
Exceptions
IllegalStateExceptionif the named field has already been written or fieldName is NULL or empty
virtual PdxWriterPtr apache::geode::client::PdxWriter::writeBooleanArray ( const char *  fieldName,
bool *  array,
int  length 
)
pure virtual

Writes the named field with the given value to the serialized form.

The fields type is bool*.

C++ bool* is mapped to Java boolean[]

Parameters
fieldNamethe name of the field to write
arraythe value of the field to write
lengththe length of the array field to write
Returns
this PdxWriter
Exceptions
IllegalStateExceptionif the named field has already been written or fieldName is NULL or empty.
virtual PdxWriterPtr apache::geode::client::PdxWriter::writeByte ( const char *  fieldName,
int8_t  value 
)
pure virtual

Writes the named field with the given value to the serialized form.

The fields type is int8_t.

C++ int8_t is mapped to Java byte

Parameters
fieldNamethe name of the field to write
valuethe value of the field to write
Returns
this PdxWriter
Exceptions
IllegalStateExceptionif the named field has already been written or fieldName is NULL or empty
virtual PdxWriterPtr apache::geode::client::PdxWriter::writeByteArray ( const char *  fieldName,
int8_t *  array,
int  length 
)
pure virtual

Writes the named field with the given value to the serialized form.

The fields type is int8_t*.

C++ int8_t* is mapped to Java byte[].

Parameters
fieldNamethe name of the field to write
arraythe value of the field to write
lengththe length of the array field to write
Returns
this PdxWriter
Exceptions
IllegalStateExceptionif the named field has already been written or fieldName is NULL or empty.
virtual PdxWriterPtr apache::geode::client::PdxWriter::writeChar ( const char *  fieldName,
char  value 
)
pure virtual

Writes the named field with the given value to the serialized form.

The fields type is char.

C++ char is mapped to Java char

.

Parameters
fieldNameThe name of the field to write.
valueThe value of the field to write
Returns
this PdxWriter
Exceptions
IllegalStateExceptionif the named field has already been written or fieldName is NULL or empty
virtual PdxWriterPtr apache::geode::client::PdxWriter::writeCharArray ( const char *  fieldName,
char *  array,
int  length 
)
pure virtual

Writes the named field with the given value to the serialized form.

The fields type is char*.

C++ char* is mapped to Java char[].

Parameters
fieldNamethe name of the field to write
arraythe value of the field to write
lengththe length of the array field to write
Returns
this PdxWriter
Exceptions
IllegalStateExceptionif the named field has already been written or fieldName is NULL or empty.
virtual PdxWriterPtr apache::geode::client::PdxWriter::writeDate ( const char *  fieldName,
CacheableDatePtr  date 
)
pure virtual

Writes the named field with the given value to the serialized form.

The fields type is CacheableDatePtr.

C++ CacheableDatePtr is mapped to Java Date

Parameters
fieldNamethe name of the field to write
valuethe value of the field to write
Returns
this PdxWriter
Exceptions
IllegalStateExceptionif the named field has already been written or fieldName is NULL or empty
virtual PdxWriterPtr apache::geode::client::PdxWriter::writeDouble ( const char *  fieldName,
double  value 
)
pure virtual

Writes the named field with the given value to the serialized form.

The fields type is double.

C++ double is mapped to Java double

Parameters
fieldNamethe name of the field to write
valuethe value of the field to write
Returns
this PdxWriter
Exceptions
IllegalStateExceptionif the named field has already been written or fieldName is NULL or empty
virtual PdxWriterPtr apache::geode::client::PdxWriter::writeDoubleArray ( const char *  fieldName,
double *  array,
int  length 
)
pure virtual

Writes the named field with the given value to the serialized form.

The fields type is double*.

C++ double* is mapped to Java double[].

Parameters
fieldNamethe name of the field to write
arraythe value of the field to write
lengththe length of the array field to write
Returns
this PdxWriter
Exceptions
IllegalStateExceptionif the named field has already been written or fieldName is NULL or empty.
virtual PdxWriterPtr apache::geode::client::PdxWriter::writeFloat ( const char *  fieldName,
float  value 
)
pure virtual

Writes the named field with the given value to the serialized form.

The fields type is float.

C++ float is mapped to Java float

Parameters
fieldNamethe name of the field to write
valuethe value of the field to write
Returns
this PdxWriter
Exceptions
IllegalStateExceptionif the named field has already been written or fieldName is NULL or empty
virtual PdxWriterPtr apache::geode::client::PdxWriter::writeFloatArray ( const char *  fieldName,
float *  array,
int  length 
)
pure virtual

Writes the named field with the given value to the serialized form.

The fields type is float*.

C++ float* is mapped to Java float[].

Parameters
fieldNamethe name of the field to write
arraythe value of the field to write
lengththe length of the array field to write
Returns
this PdxWriter
Exceptions
IllegalStateExceptionif the named field has already been written or fieldName is NULL or empty.
virtual PdxWriterPtr apache::geode::client::PdxWriter::writeInt ( const char *  fieldName,
int32_t  value 
)
pure virtual

Writes the named field with the given value to the serialized form.

The fields type is int32_t.

C++ int32_t is mapped to Java int

Parameters
fieldNamethe name of the field to write
valuethe value of the field to write
Returns
this PdxWriter
Exceptions
IllegalStateExceptionif the named field has already been written or fieldName is NULL or empty
virtual PdxWriterPtr apache::geode::client::PdxWriter::writeIntArray ( const char *  fieldName,
int32_t *  array,
int  length 
)
pure virtual

Writes the named field with the given value to the serialized form.

The fields type is int32_t*.

C++ int32_t* is mapped to Java int[].

Parameters
fieldNamethe name of the field to write
arraythe value of the field to write
lengththe length of the array field to write
Returns
this PdxWriter
Exceptions
IllegalStateExceptionif the named field has already been written or fieldName is NULL or empty.
virtual PdxWriterPtr apache::geode::client::PdxWriter::writeLong ( const char *  fieldName,
int64_t  value 
)
pure virtual

Writes the named field with the given value to the serialized form.

The fields type is int64_t.

C++ int64_t is mapped to Java long

Parameters
fieldNamethe name of the field to write
valuethe value of the field to write
Returns
this PdxWriter
Exceptions
IllegalStateExceptionif the named field has already been written or fieldName is NULL or empty
virtual PdxWriterPtr apache::geode::client::PdxWriter::writeLongArray ( const char *  fieldName,
int64_t *  array,
int  length 
)
pure virtual

Writes the named field with the given value to the serialized form.

The fields type is int64_t*.

C++ int64_t* is mapped to Java long[].

Parameters
fieldNamethe name of the field to write
arraythe value of the field to write
lengththe length of the array field to write
Returns
this PdxWriter
Exceptions
IllegalStateExceptionif the named field has already been written or fieldName is NULL or empty.
virtual PdxWriterPtr apache::geode::client::PdxWriter::writeObject ( const char *  fieldName,
CacheablePtr  value 
)
pure virtual

Writes the named field with the given value to the serialized form.

The fields type is CacheablePtr.

C++ CacheablePtr is mapped to Java object.

It is best to use one of the other writeXXX methods if your field type will always be XXX. This method allows the field value to be anything that is an instance of Object. This gives you more flexibility but more space is used to store the serialized field.

Note that some Java objects serialized with this method may not be compatible with non-java languages.

Parameters
fieldNamethe name of the field to write
valuethe value of the field to write
Returns
this PdxWriter
Exceptions
IllegalStateExceptionif the named field has already been written or fieldName is NULL or empty.
virtual PdxWriterPtr apache::geode::client::PdxWriter::writeObjectArray ( const char *  fieldName,
CacheableObjectArrayPtr  array 
)
pure virtual

Writes the named field with the given value to the serialized form.

The fields type is CacheableObjectArrayPtr. C++ CacheableObjectArrayPtr is mapped to Java Object[]. For how each element of the array is a mapped to C++ see writeObject. Note that this call may serialize elements that are not compatible with non-java languages.

Parameters
fieldNamethe name of the field to write
arraythe value of the field to write
Returns
this PdxWriter
Exceptions
IllegalStateExceptionif the named field has already been written or fieldName is NULL or empty.
virtual PdxWriterPtr apache::geode::client::PdxWriter::writeShort ( const char *  fieldName,
int16_t  value 
)
pure virtual

Writes the named field with the given value to the serialized form.

The fields type is int16_t.

C++ int16_t is mapped to Java short

Parameters
fieldNamethe name of the field to write
valuethe value of the field to write
Returns
this PdxWriter
Exceptions
IllegalStateExceptionif the named field has already been written or fieldName is NULL or empty
virtual PdxWriterPtr apache::geode::client::PdxWriter::writeShortArray ( const char *  fieldName,
int16_t *  array,
int  length 
)
pure virtual

Writes the named field with the given value to the serialized form.

The fields type is int16_t*.

C++ int16_t* is mapped to Java short[].

Parameters
fieldNamethe name of the field to write
arraythe value of the field to write
lengththe length of the array field to write
Returns
this PdxWriter
Exceptions
IllegalStateExceptionif the named field has already been written or fieldName is NULL or empty.
virtual PdxWriterPtr apache::geode::client::PdxWriter::writeString ( const char *  fieldName,
const char *  value 
)
pure virtual

Writes the named field with the given value to the serialized form.

The fields type is char*.

C++ char* is mapped to Java String

Parameters
fieldNamethe name of the field to write
valuethe value of the field to write
Returns
this PdxWriter
Exceptions
IllegalStateExceptionif the named field has already been written or fieldName is NULL or empty
virtual PdxWriterPtr apache::geode::client::PdxWriter::writeStringArray ( const char *  fieldName,
char **  array,
int  length 
)
pure virtual

Writes the named field with the given value to the serialized form.

The fields type is char**.

C++ char** is mapped to Java String[].

Parameters
fieldNamethe name of the field to write
arraythe value of the field to write
lengththe length of the array field to write
Returns
this PdxWriter
Exceptions
IllegalStateExceptionif the named field has already been written or fieldName is NULL or empty.
virtual PdxWriterPtr apache::geode::client::PdxWriter::writeUnreadFields ( PdxUnreadFieldsPtr  unread)
pure virtual

Writes the given unread fields to the serialized form.

The unread fields are obtained by calling PdxReader#readUnreadFields.

This method must be called first before any of the writeXXX methods is called.

Parameters
unreadthe object that was returned from PdxReader#readUnreadFields.
Returns
this PdxWriter
Exceptions
IllegalStateExceptionif one of the writeXXX methods has already been called.
virtual PdxWriterPtr apache::geode::client::PdxWriter::writeWideChar ( const char *  fieldName,
wchar_t  value 
)
pure virtual

Writes the named field with the given value to the serialized form The fields type is wchar_t

C++ wchar_t is mapped to Java char

Parameters
fieldNameThe name of the field to write
valueThe value of the field to write
Returns
this PdxWriter
Exceptions
IllegalStateExceptionif the named field has already been written or fieldName is NULL or empty
virtual PdxWriterPtr apache::geode::client::PdxWriter::writeWideCharArray ( const char *  fieldName,
wchar_t *  array,
int  length 
)
pure virtual

Writes the named field with the given value to the serialized form.

The fields type is wchar_t*.

C++ wchar_t* is mapped to Java char[].

Parameters
fieldNamethe name of the field to write
arraythe value of the field to write
lengththe length of the array field to write
Returns
this PdxWriter
Exceptions
IllegalStateExceptionif the named field has already been written or fieldName is NULL or empty.
virtual PdxWriterPtr apache::geode::client::PdxWriter::writeWideString ( const char *  fieldName,
const wchar_t *  value 
)
pure virtual

Writes the named field with the given value to the serialized form.

The fields type is wchar_t*.

C++ wchar_t* is mapped to Java String

Parameters
fieldNamethe name of the field to write
valuethe value of the field to write
Returns
this PdxWriter
Exceptions
IllegalStateExceptionif the named field has already been written or fieldName is NULL or empty
virtual PdxWriterPtr apache::geode::client::PdxWriter::writeWideStringArray ( const char *  fieldName,
wchar_t **  array,
int  length 
)
pure virtual

Writes the named field with the given value to the serialized form.

The fields type is wchar_t**.

C++ wchar_t** is mapped to Java String[].

Parameters
fieldNamethe name of the field to write
arraythe value of the field to write
lengththe length of the array field to write
Returns
this PdxWriter
Exceptions
IllegalStateExceptionif the named field has already been written or fieldName is NULL or empty.

Pivotal GemFire C++ Cache API Documentation