Photon C++ Client API  5.0.7.3
Public Member Functions | List of all members
Hashtable Class Reference
Inheritance diagram for Hashtable:
Inheritance graph
[legend]
Collaboration diagram for Hashtable:
Collaboration graph
[legend]

Public Member Functions

virtual void put (const Hashtable &src)
 
template<typename FKeyType , typename FValueType >
void put (const FKeyType &key, const FValueType &val)
 
template<typename FKeyType >
void put (const FKeyType &key)
 
template<typename FKeyType , typename FValueType >
void put (const FKeyType &key, const FValueType pVal, int size)
 
template<typename FKeyType , typename FValueType >
void put (const FKeyType &key, const FValueType pVal, const int *sizes)
 
- Public Member Functions inherited from AssociativeContainerBase< Hashtable, Object >
virtual ~AssociativeContainerBase (void)=0
 
AssociativeContainerBase< Hashtable, Object > & operator= (const AssociativeContainerBase< Hashtable, Object > &toCopy)
 
virtual bool operator== (const AssociativeContainerBase< Hashtable, Object > &toCompare) const
 
virtual bool operator!= (const AssociativeContainerBase< Hashtable, Object > &toCompare) const
 
virtual const Objectoperator[] (unsigned int index) const
 
virtual const Objectoperator[] (int index) const
 
virtual Objectoperator[] (unsigned int index)
 
virtual Objectoperator[] (int index)
 
void put (const FKeyType &key, const FValueType &val)
 
void put (const FKeyType &key, const FValueType pVal, int size)
 
void put (const FKeyType &key, const FValueType pVal, const int *sizes)
 
const ObjectgetValue (const FKeyType &key) const
 
ObjectgetValue (const FKeyType &key)
 
virtual unsigned int getSize (void) const
 
virtual const JVector< Object > & getKeys (void) const
 
void remove (const FKeyType &key)
 
virtual void removeAt (unsigned int index)
 
bool contains (const FKeyType &key) const
 
virtual void removeAllElements (void)
 
virtual JStringtoString (JString &retStr, bool withTypes=false) const
 
virtual JStringtoString (JString &retStr, bool withTypes=false) const =0
 
JString toString (bool withTypes=false) const
 
- Public Member Functions inherited from Base
virtual ~Base (void)=0
 
- Public Member Functions inherited from LoggingBase< Base >
virtual ~LoggingBase (void)=0
 
- Public Member Functions inherited from ToString
virtual ~ToString (void)
 
virtual JString typeToString (void) const
 
JString toString (bool withTypes=false) const
 

Additional Inherited Members

- Static Public Member Functions inherited from LoggingBase< Base >
static void setListener (const BaseListener *pBaseListener)
 
static int getDebugOutputLevel (void)
 
static bool setDebugOutputLevel (int debugLevel)
 
static const LogFormatOptionsgetLogFormatOptions (void)
 
static void setLogFormatOptions (const LogFormatOptions &options)
 

Detailed Description

The Hashtable class together with the Dictionary class template is one of the two main container classes for objects to be transmitted over Photon when using the C++ Client.

This class implements the well-known concept of a container structure storing an arbitrary number of key/value-pairs.

In contrast to a Dictionary, the types of both the keys and also the values in a Hashtable can differ for every entry. This adds flexibility, but it also reduces type safety and means, that the type infos have to be stored twice (once for the key and once for the value) per entry in a Hashtable, while in a Dictionary it only has to be stored twice for the whole Dictionary, no matter how many entries are in there. Therefor with Dictionaries transferring the same amount of key-value pairs will cause less traffic than with Hashtables.

Please have a look at the Table of Datatypes for a list of types, that are supported as keys and as values.

Please refer to the documentation for put() and getValue() to see how to store and access data in a Hashtable.

See also
put(), getValue(), KeyObject, ValueObject, Dictionary

Member Function Documentation

◆ put() [1/5]

void put ( const Hashtable src)
virtual

Adds all pairs of a key and a corresponding value from the passed instance to the instance, on which it is called on. If a key is already existing, then its old value will be replaced with the new one.

Parameters
srcinstance, from which to add the content
Returns
nothing.

Reimplemented from AssociativeContainerBase< Hashtable, Object >.

◆ put() [2/5]

void put ( const FKeyType &  key,
const FValueType &  val 
)

Adds a pair of a key and a corresponding value to the instance.

If the key is already existing, then it's old value will be replaced with the new one. Please have a look at the table of datatypes for a list of supported types for keys and values

Parameters
keythe key to add
valthe value to add

◆ put() [3/5]

void put ( const FKeyType &  key)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

This overload adds an empty object as value for the provided key.

◆ put() [4/5]

void put ( const FKeyType &  key,
const FValueType  pVal,
int  size 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

This overload accepts singledimensional arrays and NULL-pointers passed for parameter pVal. NULL pointers are only legal input, if size is 0

Parameters
keythe key to add
pValthe value array to add
sizethe size of the value array

◆ put() [5/5]

void put ( const FKeyType &  key,
const FValueType  pVal,
const int *  sizes 
)