VMware VMware GemFire Native C++ Reference 10.4.3
|
PdxInstanceFactory gives you a way to create PdxInstances. More...
#include <PdxInstanceFactory.hpp>
Public Member Functions | |
std::shared_ptr< PdxInstance > | create () |
Create a PdxInstance . | |
PdxInstanceFactory & | markIdentityField (const std::string &fieldName) |
Indicate that the named field should be included in hashCode and equals (operator==()) checks of this object on a server that is accessing PdxInstance or when a client executes a query on a server. | |
PdxInstanceFactory & | writeArrayOfByteArrays (const std::string &fieldName, int8_t **value, int32_t arrayLength, int32_t *elementLength) |
Writes the named field with the given value to the serialized form. | |
PdxInstanceFactory & | writeBoolean (const std::string &fieldName, bool value) |
Writes the named field with the given value to the serialized form. | |
PdxInstanceFactory & | writeBooleanArray (const std::string &fieldName, const std::vector< bool > &value) |
Writes the named field with the given value to the serialized form. | |
PdxInstanceFactory & | writeByte (const std::string &fieldName, int8_t value) |
Writes the named field with the given value to the serialized form. | |
PdxInstanceFactory & | writeByteArray (const std::string &fieldName, const std::vector< int8_t > &value) |
Writes the named field with the given value to the serialized form. | |
PdxInstanceFactory & | writeChar (const std::string &fieldName, char value) |
Writes the named field with the given value to the serialized form. | |
PdxInstanceFactory & | writeChar (const std::string &fieldName, char16_t value) |
Writes the named field with the given value to the serialized form. | |
PdxInstanceFactory & | writeCharArray (const std::string &fieldName, const std::vector< char16_t > &value) |
Writes the named field with the given value to the serialized form. | |
PdxInstanceFactory & | writeDate (const std::string &fieldName, std::shared_ptr< CacheableDate > value) |
Writes the named field with the given value to the serialized form. | |
PdxInstanceFactory & | writeDouble (const std::string &fieldName, double value) |
Writes the named field with the given value to the serialized form. | |
PdxInstanceFactory & | writeDoubleArray (const std::string &fieldName, const std::vector< double > &value) |
Writes the named field with the given value to the serialized form. | |
PdxInstanceFactory & | writeFloat (const std::string &fieldName, float value) |
Writes the named field with the given value to the serialized form. | |
PdxInstanceFactory & | writeFloatArray (const std::string &fieldName, const std::vector< float > &value) |
Writes the named field with the given value to the serialized form. | |
PdxInstanceFactory & | writeInt (const std::string &fieldName, int32_t value) |
Writes the named field with the given value to the serialized form. | |
PdxInstanceFactory & | writeIntArray (const std::string &fieldName, const std::vector< int32_t > &value) |
Writes the named field with the given value to the serialized form. | |
PdxInstanceFactory & | writeLong (const std::string &fieldName, int64_t value) |
Writes the named field with the given value to the serialized form. | |
PdxInstanceFactory & | writeLongArray (const std::string &fieldName, const std::vector< int64_t > &value) |
Writes the named field with the given value to the serialized form. | |
PdxInstanceFactory & | writeObject (const std::string &fieldName, std::shared_ptr< Cacheable > value) |
Writes the named field with the given value to the serialized form. | |
PdxInstanceFactory & | writeObjectArray (const std::string &fieldName, std::shared_ptr< CacheableObjectArray > value) |
Writes the named field with the given value to the serialized form. | |
PdxInstanceFactory & | writeShort (const std::string &fieldName, int16_t value) |
Writes the named field with the given value to the serialized form. | |
PdxInstanceFactory & | writeShortArray (const std::string &fieldName, const std::vector< int16_t > &value) |
Writes the named field with the given value to the serialized form. | |
PdxInstanceFactory & | writeString (const std::string &fieldName, const std::string &value) |
Writes the named field with the given value to the serialized form. | |
PdxInstanceFactory & | writeStringArray (const std::string &fieldName, const std::vector< std::string > &value) |
Writes the named field with the given value to the serialized form. | |
PdxInstanceFactory gives you a way to create PdxInstances.
Call the write methods to populate the field data and then call create
to produce an actual instance that contains the data. To create a factory call Cache#createPdxInstanceFactory
. A factory can only create a single instance. To create multiple instances create multiple factories or use PdxInstance#createWriter
to create subsequent instances.
std::shared_ptr< PdxInstance > apache::geode::client::PdxInstanceFactory::create | ( | ) |
Create a PdxInstance
.
The instance will contain any data written to this factory using the write methods.
IllegalStateException | if called more than once |
PdxInstanceFactory & apache::geode::client::PdxInstanceFactory::markIdentityField | ( | const std::string & | fieldName | ) |
Indicate that the named field should be included in hashCode and equals (operator==()) checks of this object on a server that is accessing PdxInstance
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 (operator==()) methods of PdxInstance
. Because of this, the identity fields should themselves either be primitives, or implement hashCode and equals (operator==()).
If no fields are set as identity fields, then all fields will be used in hashCode and equals (operator==()) checks.
The identity fields should make marked after they are written using a write* method.
fieldName | the name of the field to mark as an identity field. |
IllegalStateException | if the named field does not exist. |
PdxInstanceFactory & apache::geode::client::PdxInstanceFactory::writeArrayOfByteArrays | ( | const std::string & | fieldName, |
int8_t ** | value, | ||
int32_t | arrayLength, | ||
int32_t * | elementLength | ||
) |
Writes the named field with the given value to the serialized form.
The fields type is int8_t**
.
Java byte[][] is mapped to C++ int8_t**.
fieldName | the name of the field to write |
value | 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 |
IllegalStateException | if the named field has already been written or fieldName is nullptr or empty. |
PdxInstanceFactory & apache::geode::client::PdxInstanceFactory::writeBoolean | ( | const std::string & | fieldName, |
bool | value | ||
) |
Writes the named field with the given value to the serialized form.
The fields type is bool
.
Java boolean is mapped to C++ bool.
fieldName | the name of the field to write |
value | the value of the field to write |
IllegalStateException | if the named field has already been written or fieldName is nullptr or empty. |
PdxInstanceFactory & apache::geode::client::PdxInstanceFactory::writeBooleanArray | ( | const std::string & | fieldName, |
const std::vector< bool > & | value | ||
) |
Writes the named field with the given value to the serialized form.
The fields type is bool*
.
Java boolean[] is mapped to C++ bool*.
fieldName | the name of the field to write |
value | the value of the field to write |
IllegalStateException | if the named field has already been written or fieldName is nullptr or empty. |
PdxInstanceFactory & apache::geode::client::PdxInstanceFactory::writeByte | ( | const std::string & | fieldName, |
int8_t | value | ||
) |
Writes the named field with the given value to the serialized form.
The fields type is int8_t
.
Java byte is mapped to C++ int8_t
fieldName | the name of the field to write |
value | the value of the field to write |
IllegalStateException | if the named field has already been written or fieldName is nullptr or empty. |
PdxInstanceFactory & apache::geode::client::PdxInstanceFactory::writeByteArray | ( | const std::string & | fieldName, |
const std::vector< int8_t > & | value | ||
) |
Writes the named field with the given value to the serialized form.
The fields type is int8_t*
.
Java byte[] is mapped to C++ int8_t*.
fieldName | the name of the field to write |
value | the value of the field to write |
IllegalStateException | if the named field has already been written or fieldName is nullptr or empty. |
PdxInstanceFactory & apache::geode::client::PdxInstanceFactory::writeChar | ( | const std::string & | fieldName, |
char | value | ||
) |
Writes the named field with the given value to the serialized form.
The fields type is char
.
Java char is mapped to C++ char.
fieldName | the name of the field to write |
value | the value of the field to write |
IllegalStateException | if the named field has already been written or fieldName is nullptr or empty. |
PdxInstanceFactory & apache::geode::client::PdxInstanceFactory::writeChar | ( | const std::string & | fieldName, |
char16_t | value | ||
) |
Writes the named field with the given value to the serialized form.
The fields type is char16_t
.
Java char is mapped to C++ char16_t.
fieldName | the name of the field to write |
value | the value of the field to write |
IllegalStateException | if the named field has already been written or fieldName is nullptr or empty. |
PdxInstanceFactory & apache::geode::client::PdxInstanceFactory::writeCharArray | ( | const std::string & | fieldName, |
const std::vector< char16_t > & | value | ||
) |
Writes the named field with the given value to the serialized form.
The fields type is char16_t*
.
Java char[] is mapped to C++ char16_t*.
fieldName | the name of the field to write |
value | the value of the field to write |
IllegalStateException | if the named field has already been written or fieldName is nullptr or empty. |
PdxInstanceFactory & apache::geode::client::PdxInstanceFactory::writeDate | ( | const std::string & | fieldName, |
std::shared_ptr< CacheableDate > | value | ||
) |
Writes the named field with the given value to the serialized form.
The fields type is CacheableDatePtr
.
Java Date is mapped to C++ std::shared_ptr<CacheableDate>.
fieldName | the name of the field to write |
value | the value of the field to write |
IllegalStateException | if the named field has already been written or fieldName is nullptr or empty. |
PdxInstanceFactory & apache::geode::client::PdxInstanceFactory::writeDouble | ( | const std::string & | fieldName, |
double | value | ||
) |
Writes the named field with the given value to the serialized form.
The fields type is double
.
Java double is mapped to C++ double.
fieldName | the name of the field to write |
value | the value of the field to write |
IllegalStateException | if the named field has already been written or fieldName is nullptr or empty. |
PdxInstanceFactory & apache::geode::client::PdxInstanceFactory::writeDoubleArray | ( | const std::string & | fieldName, |
const std::vector< double > & | value | ||
) |
Writes the named field with the given value to the serialized form.
The fields type is double*
.
Java double[] is mapped to C++ double*.
fieldName | the name of the field to write |
value | the value of the field to write |
IllegalStateException | if the named field has already been written or fieldName is nullptr or empty. |
PdxInstanceFactory & apache::geode::client::PdxInstanceFactory::writeFloat | ( | const std::string & | fieldName, |
float | value | ||
) |
Writes the named field with the given value to the serialized form.
The fields type is float
.
Java float is mapped to C++ float.
fieldName | the name of the field to write |
value | the value of the field to write |
IllegalStateException | if the named field has already been written or fieldName is nullptr or empty. |
PdxInstanceFactory & apache::geode::client::PdxInstanceFactory::writeFloatArray | ( | const std::string & | fieldName, |
const std::vector< float > & | value | ||
) |
Writes the named field with the given value to the serialized form.
The fields type is float*
.
Java float[] is mapped to C++ float*.
fieldName | the name of the field to write |
value | the value of the field to write |
IllegalStateException | if the named field has already been written or fieldName is nullptr or empty. |
PdxInstanceFactory & apache::geode::client::PdxInstanceFactory::writeInt | ( | const std::string & | fieldName, |
int32_t | value | ||
) |
Writes the named field with the given value to the serialized form.
The fields type is int32_t
.
Java int is mapped to C++ int32_t.
fieldName | the name of the field to write |
value | the value of the field to write |
IllegalStateException | if the named field has already been written or fieldName is nullptr or empty. |
PdxInstanceFactory & apache::geode::client::PdxInstanceFactory::writeIntArray | ( | const std::string & | fieldName, |
const std::vector< int32_t > & | value | ||
) |
Writes the named field with the given value to the serialized form.
The fields type is int32_t*
.
Java int[] is mapped to C++ int32_t*.
fieldName | the name of the field to write |
value | the value of the field to write |
IllegalStateException | if the named field has already been written or fieldName is nullptr or empty. |
PdxInstanceFactory & apache::geode::client::PdxInstanceFactory::writeLong | ( | const std::string & | fieldName, |
int64_t | value | ||
) |
Writes the named field with the given value to the serialized form.
The fields type is int64_t
.
Java long is mapped to C++ int64_t.
fieldName | the name of the field to write |
value | the value of the field to write |
IllegalStateException | if the named field has already been written or fieldName is nullptr or empty. |
PdxInstanceFactory & apache::geode::client::PdxInstanceFactory::writeLongArray | ( | const std::string & | fieldName, |
const std::vector< int64_t > & | value | ||
) |
Writes the named field with the given value to the serialized form.
The fields type is int64_t*
.
Java long[] is mapped to C++ int64_t*.
fieldName | the name of the field to write |
value | the value of the field to write |
IllegalStateException | if the named field has already been written or fieldName is nullptr or empty. |
PdxInstanceFactory & apache::geode::client::PdxInstanceFactory::writeObject | ( | const std::string & | fieldName, |
std::shared_ptr< Cacheable > | value | ||
) |
Writes the named field with the given value to the serialized form.
The fields type is CacheablePtr
.
Java object is mapped to C++ std::shared_ptr<Cacheable>.
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.
fieldName | the name of the field to write |
value | the value of the field to write |
IllegalStateException | if the named field has already been written or fieldName is nullptr or empty. |
PdxInstanceFactory & apache::geode::client::PdxInstanceFactory::writeObjectArray | ( | const std::string & | fieldName, |
std::shared_ptr< CacheableObjectArray > | value | ||
) |
Writes the named field with the given value to the serialized form.
The fields type is CacheableObjectArrayPtr
. Java Object[] is mapped to C++ std::shared_ptr<CacheableObjectArray>. 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.
fieldName | the name of the field to write |
value | the value of the field to write |
IllegalStateException | if the named field has already been written or fieldName is nullptr or empty. |
PdxInstanceFactory & apache::geode::client::PdxInstanceFactory::writeShort | ( | const std::string & | fieldName, |
int16_t | value | ||
) |
Writes the named field with the given value to the serialized form.
The fields type is int16_t
.
Java short is mapped to C++ int16_t.
fieldName | the name of the field to write |
value | the value of the field to write |
IllegalStateException | if the named field has already been written or fieldName is nullptr or empty. |
PdxInstanceFactory & apache::geode::client::PdxInstanceFactory::writeShortArray | ( | const std::string & | fieldName, |
const std::vector< int16_t > & | value | ||
) |
Writes the named field with the given value to the serialized form.
The fields type is int16_t*
.
Java short[] is mapped to C++ int16_t*.
fieldName | the name of the field to write |
value | the value of the field to write |
IllegalStateException | if the named field has already been written or fieldName is nullptr or empty. |
PdxInstanceFactory & apache::geode::client::PdxInstanceFactory::writeString | ( | const std::string & | fieldName, |
const std::string & | value | ||
) |
Writes the named field with the given value to the serialized form.
The fields type is std::string
.
Java String is mapped to C++ std::string.
fieldName | the name of the field to write |
value | the value of the field to write |
IllegalStateException | if the named field has already been written or fieldName is nullptr or empty. |
PdxInstanceFactory & apache::geode::client::PdxInstanceFactory::writeStringArray | ( | const std::string & | fieldName, |
const std::vector< std::string > & | value | ||
) |
Writes the named field with the given value to the serialized form.
The fields type is char**
.
Java String[] is mapped to C++ char**.
fieldName | the name of the field to write |
value | the value of the field to write |
IllegalStateException | if the named field has already been written or fieldName is nullptr or empty. |