VMware Tanzu GemFire Native C++ Reference 10.3.0
apache::geode::client::CacheableString Class Reference

Implement a immutable C string wrapper that can serve as a distributable key object for caching as well as being a string value. More...

#include <CacheableString.hpp>

Inherits internal::DataSerializablePrimitive, and apache::geode::client::CacheableKey.

Inherited by apache::geode::client::CacheableFileName.

Public Member Functions

virtual int32_t hashcode () const override
 return the hashcode for this key. More...
 
std::string::size_type length () const
 Return the length of the contained string. More...
 
virtual size_t objectSize () const override
 return the size in bytes of the instance being serialized. More...
 
virtual bool operator== (const CacheableKey &other) const override
 return true if this key matches other. More...
 
virtual 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...
 
static std::shared_ptr< SerializablecreateDeserializable ()
 creation function for strings More...
 
static std::shared_ptr< SerializablecreateDeserializableHuge ()
 creation function for strings > 64K length More...
 
static std::shared_ptr< SerializablecreateUTFDeserializable ()
 creation function for wide strings More...
 
static std::shared_ptr< SerializablecreateUTFDeserializableHuge ()
 creation function for wide strings > 64K length in UTF8 encoding More...
 

Detailed Description

Implement a immutable C string wrapper that can serve as a distributable key object for caching as well as being a string value.

Member Function Documentation

◆ create()

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.

◆ createDeserializable()

static std::shared_ptr< Serializable > apache::geode::client::CacheableString::createDeserializable ( )
static

creation function for strings

◆ createDeserializableHuge()

static std::shared_ptr< Serializable > apache::geode::client::CacheableString::createDeserializableHuge ( )
static

creation function for strings > 64K length

◆ createUTFDeserializable()

static std::shared_ptr< Serializable > apache::geode::client::CacheableString::createUTFDeserializable ( )
static

creation function for wide strings

◆ createUTFDeserializableHuge()

static std::shared_ptr< Serializable > apache::geode::client::CacheableString::createUTFDeserializableHuge ( )
static

creation function for wide strings > 64K length in UTF8 encoding

◆ hashcode()

virtual int32_t apache::geode::client::CacheableString::hashcode ( ) const
overridevirtual

return the hashcode for this key.

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

Reimplemented in apache::geode::client::CacheableFileName.

◆ length()

std::string::size_type apache::geode::client::CacheableString::length ( ) const
inline

Return the length of the contained string.

◆ objectSize()

virtual size_t apache::geode::client::CacheableString::objectSize ( ) const
overridevirtual

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 from apache::geode::client::Serializable.

◆ operator==()

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

return true if this key matches other.

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

◆ toString()

virtual std::string apache::geode::client::CacheableString::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::Serializable.


Apache Geode C++ Cache API Documentation