VMware Tanzu GemFire Native C++ Reference 10.2.7
apache::geode::client::PdxWrapper Class Reference

The PdxWrapper class allows domain classes to be used in Region operations. More...

#include <PdxWrapper.hpp>

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

Public Member Functions

void fromData (PdxReader &input) override
 Deserialize this object. More...
 
const std::string & getClassName () const override
 Get the Type for the Object. More...
 
std::shared_ptr< void > getObject ()
 Returns the pointer to the user object which is deserialized with a PdxSerializer. More...
 
int32_t hashcode () const override
 return the hashcode for this key. More...
 
virtual size_t objectSize () const
 return the size in bytes of the instance being serialized. More...
 
bool operator== (const CacheableKey &other) const override
 return true if this key matches other. More...
 
 PdxWrapper (std::shared_ptr< void > userObject, std::string className)
 Constructor which takes the address of the user object to contain for PDX serialization. More...
 
void toData (PdxWriter &output) const override
 Serialize this object in Geode PDX format. More...
 
std::string toString () const override
 Display this object as 'string', which depends on the implementation in the subclasses. More...
 

Static Public Member Functions

template<class _T >
static std::shared_ptr< CacheableKeycreate (_T value)
 Factory method that creates the key type that matches the type of value. More...
 
template<class _T >
static std::shared_ptr< Serializablecreate (_T value)
 Factory method that creates the Serializable object that matches the type of value. More...
 

Detailed Description

The PdxWrapper class allows domain classes to be used in Region operations.

A user domain object should be wrapped in an instance of a PdxWrapper with a PdxSerializer registered that can handle the user domain class.

Constructor & Destructor Documentation

◆ PdxWrapper()

apache::geode::client::PdxWrapper::PdxWrapper ( std::shared_ptr< void >  userObject,
std::string  className 
)

Constructor which takes the address of the user object to contain for PDX serialization.

Parameters
userObjectthe void pointer to an instance of a user object - NOTE: PdxWrapper takes ownership.
classNamethe fully qualified class name to map this user object to the Java side.

Member Function Documentation

◆ create() [1/2]

template<class _T >
static std::shared_ptr< CacheableKey > apache::geode::client::CacheableKey::create ( _T  value)
staticinherited

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

For user defined derivations of CacheableKey, the method apache::geode::client::CacheableKey::create may be overloaded.

◆ create() [2/2]

template<class _T >
static std::shared_ptr< Serializable > apache::geode::client::Serializable::create ( _T  value)
staticinherited

Factory method that creates the Serializable object that matches the type of value.

For user defined derivations of Serializable, the method apache::geode::client::Serializable::create may be overloaded.

◆ fromData()

void apache::geode::client::PdxWrapper::fromData ( PdxReader input)
overridevirtual

Deserialize this object.

Parameters
inputto deserialize the PDX object

Implements apache::geode::client::PdxSerializable.

◆ getClassName()

const std::string & apache::geode::client::PdxWrapper::getClassName ( ) const
overridevirtual

Get the Type for the Object.

Equivalent to the C# Type->GetType() API.

Implements apache::geode::client::PdxSerializable.

◆ getObject()

std::shared_ptr< void > apache::geode::client::PdxWrapper::getObject ( )

Returns the pointer to the user object which is deserialized with a PdxSerializer.

User code (such as in PdxSerializer) should cast it to a pointer of the known user class.

◆ hashcode()

int32_t apache::geode::client::PdxWrapper::hashcode ( ) const
overridevirtual

return the hashcode for this key.

Reimplemented from apache::geode::client::PdxSerializable.

◆ objectSize()

virtual size_t apache::geode::client::Serializable::objectSize ( ) const
virtualinherited

return the size in bytes of the instance being serialized.

This is used to determine whether the cache is using up more physical memory than it has been configured to use. The method can return zero if the user does not require the ability to control cache memory utilization. Note that you must implement this only if you use the HeapLRU feature.

Reimplemented in apache::geode::client::CacheableDate, apache::geode::client::CacheableEnum, apache::geode::client::CacheableString, and apache::geode::client::PdxInstance.

◆ operator==()

bool apache::geode::client::PdxWrapper::operator== ( const CacheableKey other) const
overridevirtual

return true if this key matches other.

Reimplemented from apache::geode::client::PdxSerializable.

◆ toData()

void apache::geode::client::PdxWrapper::toData ( PdxWriter output) const
overridevirtual

Serialize this object in Geode PDX format.

Parameters
outputto serialize the PDX object

Implements apache::geode::client::PdxSerializable.

◆ toString()

std::string apache::geode::client::PdxWrapper::toString ( ) const
overridevirtual

Display this object as 'string', which depends on the implementation in the subclasses.

The default implementation renders the classname.

Reimplemented from apache::geode::client::PdxSerializable.


Apache Geode C++ Cache API Documentation