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

A Struct has a StructSet as its parent. More...

#include <Struct.hpp>

Inherits internal::DataSerializableFixedId_t< internal::DSFid::Struct >.

Public Member Functions

virtual const std::string & getFieldName (const int32_t index) const
 Returns the name of the field corresponding to the index number in the Struct. More...
 
const std::shared_ptr< StructSetgetStructSet () const
 Get the parent StructSet of this Struct. More...
 
size_t objectSize () const override
 always returns 0 More...
 
const std::shared_ptr< Serializableoperator[] (const std::string &fieldName) const
 Get the field value for the given field name. More...
 
const std::shared_ptr< Serializableoperator[] (int32_t index) const
 Get the field value for the given index number. More...
 
int32_t size () const
 Get the number of field values available. More...
 
 Struct (StructSet *ssPtr, std::vector< std::shared_ptr< Serializable > > &fieldValues)
 Constructor - meant only for internal use. More...
 

Static Public Member Functions

static std::shared_ptr< SerializablecreateDeserializable ()
 Factory function for registration of Struct. More...
 

Detailed Description

A Struct has a StructSet as its parent.

It contains the field values returned after executing a Query obtained from a QueryService which in turn is obtained from a Cache.

Constructor & Destructor Documentation

◆ Struct()

apache::geode::client::Struct::Struct ( StructSet ssPtr,
std::vector< std::shared_ptr< Serializable > > &  fieldValues 
)

Constructor - meant only for internal use.

Member Function Documentation

◆ createDeserializable()

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

Factory function for registration of Struct.

◆ getFieldName()

virtual const std::string & apache::geode::client::Struct::getFieldName ( const int32_t  index) const
virtual

Returns the name of the field corresponding to the index number in the Struct.

Exceptions
std::out_of_rangeif index is not found

◆ getStructSet()

const std::shared_ptr< StructSet > apache::geode::client::Struct::getStructSet ( ) const

Get the parent StructSet of this Struct.

Returns
A smart pointer to the parent StructSet of this Struct.

◆ objectSize()

size_t apache::geode::client::Struct::objectSize ( ) const
inlineoverride

always returns 0

◆ operator[]() [1/2]

const std::shared_ptr< Serializable > apache::geode::client::Struct::operator[] ( const std::string &  fieldName) const

Get the field value for the given field name.

Parameters
fieldNamethe name of the field whos value is required.
Returns
A smart pointer to the field value.
Exceptions
IllegalArgumentExceptionif the field name is not found.

◆ operator[]() [2/2]

const std::shared_ptr< Serializable > apache::geode::client::Struct::operator[] ( int32_t  index) const

Get the field value for the given index number.

Parameters
indexthe index number of the field value to get.
Returns
A smart pointer to the field value or nullptr if index out of bounds.

◆ size()

int32_t apache::geode::client::Struct::size ( ) const

Get the number of field values available.

Returns
the number of field values available.

Apache Geode C++ Cache API Documentation