gemfire::PdxWriter Class Reference

Inherits gemfire::SharedBase.


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.

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.
 PdxWriter ()
void preserveSB () const
 Atomically increment reference count.
int32_t refCount ()
 
Returns:
the reference count

void releaseSB () const
 Atomically decrement reference count, the SharedBase object is automatically deleted when its reference count goes to zero.
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.
virtual PdxWriterPtr writeBoolean (const char *fieldName, bool value)=0
 Writes the named field with the given value to the serialized form.
virtual PdxWriterPtr writeBooleanArray (const char *fieldName, bool *array, int length)=0
 Writes the named field with the given value to the serialized form.
virtual PdxWriterPtr writeByte (const char *fieldName, int8_t value)=0
 Writes the named field with the given value to the serialized form.
virtual PdxWriterPtr writeByteArray (const char *fieldName, int8_t *array, int length)=0
 Writes the named field with the given value to the serialized form.
virtual PdxWriterPtr writeChar (const char *fieldName, char value)=0
 Writes the named field with the given value to the serialized form.
virtual PdxWriterPtr writeCharArray (const char *fieldName, char *array, int length)=0
 Writes the named field with the given value to the serialized form.
virtual PdxWriterPtr writeDate (const char *fieldName, CacheableDatePtr date)=0
 Writes the named field with the given value to the serialized form.
virtual PdxWriterPtr writeDouble (const char *fieldName, double value)=0
 Writes the named field with the given value to the serialized form.
virtual PdxWriterPtr writeDoubleArray (const char *fieldName, double *array, int length)=0
 Writes the named field with the given value to the serialized form.
virtual PdxWriterPtr writeFloat (const char *fieldName, float value)=0
 Writes the named field with the given value to the serialized form.
virtual PdxWriterPtr writeFloatArray (const char *fieldName, float *array, int length)=0
 Writes the named field with the given value to the serialized form.
virtual PdxWriterPtr writeInt (const char *fieldName, int32_t value)=0
 Writes the named field with the given value to the serialized form.
virtual PdxWriterPtr writeIntArray (const char *fieldName, int32_t *array, int length)=0
 Writes the named field with the given value to the serialized form.
virtual PdxWriterPtr writeLong (const char *fieldName, int64_t value)=0
 Writes the named field with the given value to the serialized form.
virtual PdxWriterPtr writeLongArray (const char *fieldName, int64_t *array, int length)=0
 Writes the named field with the given value to the serialized form.
virtual PdxWriterPtr writeObject (const char *fieldName, CacheablePtr value)=0
 Writes the named field with the given value to the serialized form.
virtual PdxWriterPtr writeObjectArray (const char *fieldName, CacheableObjectArrayPtr array)=0
 Writes the named field with the given value to the serialized form.
virtual PdxWriterPtr writeShort (const char *fieldName, int16_t value)=0
 Writes the named field with the given value to the serialized form.
virtual PdxWriterPtr writeShortArray (const char *fieldName, int16_t *array, int length)=0
 Writes the named field with the given value to the serialized form.
virtual PdxWriterPtr writeString (const char *fieldName, const char *value)=0
 Writes the named field with the given value to the serialized form.
virtual PdxWriterPtr writeStringArray (const char *fieldName, char **array, int length)=0
 Writes the named field with the given value to the serialized form.
virtual PdxWriterPtr writeUnreadFields (PdxUnreadFieldsPtr unread)=0
 Writes the given unread fields to the serialized form.
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.
virtual PdxWriterPtr writeWideCharArray (const char *fieldName, wchar_t *array, int length)=0
 Writes the named field with the given value to the serialized form.
virtual PdxWriterPtr writeWideString (const char *fieldName, const wchar_t *value)=0
 Writes the named field with the given value to the serialized form.
virtual PdxWriterPtr writeWideStringArray (const char *fieldName, wchar_t **array, int length)=0
 Writes the named field with the given value to the serialized form.
virtual ~PdxWriter ()


Constructor & Destructor Documentation

gemfire::PdxWriter::PdxWriter (  )  [inline]

constructors

virtual gemfire::PdxWriter::~PdxWriter (  )  [inline, virtual]

destructor


Member Function Documentation

virtual PdxWriterPtr gemfire::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:
fieldName the name of the field to mark as an identity field.
Returns:
this PdxWriterPtr
Exceptions:
IllegalStateException if the named field does not exist.

void gemfire::SharedBase::preserveSB (  )  const [inherited]

Atomically increment reference count.

int32_t gemfire::SharedBase::refCount (  )  [inline, inherited]

Returns:
the reference count

void gemfire::SharedBase::releaseSB (  )  const [inherited]

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

virtual PdxWriterPtr gemfire::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:
fieldName the name of the field to write
array the value of the field to write
arrayLength the length of the actual byte array field holding individual byte arrays to write
elementLength the length of the individual byte arrays to write
Returns:
this PdxWriter
Exceptions:
IllegalStateException if the named field has already been written or fieldName is NULL or empty.

virtual PdxWriterPtr gemfire::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:
fieldName the name of the field to write
value the value of the field to write
Returns:
this PdxWriter
Exceptions:
IllegalStateException if the named field has already been written or fieldName is NULL or empty

virtual PdxWriterPtr gemfire::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:
fieldName the name of the field to write
array the value of the field to write
length the length of the array field to write
Returns:
this PdxWriter
Exceptions:
IllegalStateException if the named field has already been written or fieldName is NULL or empty.

virtual PdxWriterPtr gemfire::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:
fieldName the name of the field to write
value the value of the field to write
Returns:
this PdxWriter
Exceptions:
IllegalStateException if the named field has already been written or fieldName is NULL or empty

virtual PdxWriterPtr gemfire::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:
fieldName the name of the field to write
array the value of the field to write
length the length of the array field to write
Returns:
this PdxWriter
Exceptions:
IllegalStateException if the named field has already been written or fieldName is NULL or empty.

virtual PdxWriterPtr gemfire::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:
fieldName The name of the field to write.
value The value of the field to write
Returns:
this PdxWriter
Exceptions:
IllegalStateException if the named field has already been written or fieldName is NULL or empty

virtual PdxWriterPtr gemfire::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:
fieldName the name of the field to write
array the value of the field to write
length the length of the array field to write
Returns:
this PdxWriter
Exceptions:
IllegalStateException if the named field has already been written or fieldName is NULL or empty.

virtual PdxWriterPtr gemfire::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:
fieldName the name of the field to write
value the value of the field to write
Returns:
this PdxWriter
Exceptions:
IllegalStateException if the named field has already been written or fieldName is NULL or empty

virtual PdxWriterPtr gemfire::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:
fieldName the name of the field to write
value the value of the field to write
Returns:
this PdxWriter
Exceptions:
IllegalStateException if the named field has already been written or fieldName is NULL or empty

virtual PdxWriterPtr gemfire::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:
fieldName the name of the field to write
array the value of the field to write
length the length of the array field to write
Returns:
this PdxWriter
Exceptions:
IllegalStateException if the named field has already been written or fieldName is NULL or empty.

virtual PdxWriterPtr gemfire::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:
fieldName the name of the field to write
value the value of the field to write
Returns:
this PdxWriter
Exceptions:
IllegalStateException if the named field has already been written or fieldName is NULL or empty

virtual PdxWriterPtr gemfire::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:
fieldName the name of the field to write
array the value of the field to write
length the length of the array field to write
Returns:
this PdxWriter
Exceptions:
IllegalStateException if the named field has already been written or fieldName is NULL or empty.

virtual PdxWriterPtr gemfire::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:
fieldName the name of the field to write
value the value of the field to write
Returns:
this PdxWriter
Exceptions:
IllegalStateException if the named field has already been written or fieldName is NULL or empty

virtual PdxWriterPtr gemfire::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:
fieldName the name of the field to write
array the value of the field to write
length the length of the array field to write
Returns:
this PdxWriter
Exceptions:
IllegalStateException if the named field has already been written or fieldName is NULL or empty.

virtual PdxWriterPtr gemfire::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:
fieldName the name of the field to write
value the value of the field to write
Returns:
this PdxWriter
Exceptions:
IllegalStateException if the named field has already been written or fieldName is NULL or empty

virtual PdxWriterPtr gemfire::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:
fieldName the name of the field to write
array the value of the field to write
length the length of the array field to write
Returns:
this PdxWriter
Exceptions:
IllegalStateException if the named field has already been written or fieldName is NULL or empty.

virtual PdxWriterPtr gemfire::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:
fieldName the name of the field to write
value the value of the field to write
Returns:
this PdxWriter
Exceptions:
IllegalStateException if the named field has already been written or fieldName is NULL or empty.

virtual PdxWriterPtr gemfire::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:
fieldName the name of the field to write
array the value of the field to write
Returns:
this PdxWriter
Exceptions:
IllegalStateException if the named field has already been written or fieldName is NULL or empty.

virtual PdxWriterPtr gemfire::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:
fieldName the name of the field to write
value the value of the field to write
Returns:
this PdxWriter
Exceptions:
IllegalStateException if the named field has already been written or fieldName is NULL or empty

virtual PdxWriterPtr gemfire::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:
fieldName the name of the field to write
array the value of the field to write
length the length of the array field to write
Returns:
this PdxWriter
Exceptions:
IllegalStateException if the named field has already been written or fieldName is NULL or empty.

virtual PdxWriterPtr gemfire::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:
fieldName the name of the field to write
value the value of the field to write
Returns:
this PdxWriter
Exceptions:
IllegalStateException if the named field has already been written or fieldName is NULL or empty

virtual PdxWriterPtr gemfire::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:
fieldName the name of the field to write
array the value of the field to write
length the length of the array field to write
Returns:
this PdxWriter
Exceptions:
IllegalStateException if the named field has already been written or fieldName is NULL or empty.

virtual PdxWriterPtr gemfire::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:
unread the object that was returned from PdxReader#readUnreadFields.
Returns:
this PdxWriter
Exceptions:
IllegalStateException if one of the writeXXX methods has already been called.

virtual PdxWriterPtr gemfire::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:
fieldName The name of the field to write
value The value of the field to write
Returns:
this PdxWriter
Exceptions:
IllegalStateException if the named field has already been written or fieldName is NULL or empty

virtual PdxWriterPtr gemfire::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:
fieldName the name of the field to write
array the value of the field to write
length the length of the array field to write
Returns:
this PdxWriter
Exceptions:
IllegalStateException if the named field has already been written or fieldName is NULL or empty.

virtual PdxWriterPtr gemfire::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:
fieldName the name of the field to write
value the value of the field to write
Returns:
this PdxWriter
Exceptions:
IllegalStateException if the named field has already been written or fieldName is NULL or empty

virtual PdxWriterPtr gemfire::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:
fieldName the name of the field to write
array the value of the field to write
length the length of the array field to write
Returns:
this PdxWriter
Exceptions:
IllegalStateException if the named field has already been written or fieldName is NULL or empty.


GemFire C++ Cache API Documentation