cppcore
A small, portable C++ core library
Loading...
Searching...
No Matches
cppcore::THash< T > Class Template Reference

This class is used to calculate the hash value for a given integer or character buffer. More...

#include <Hash.h>

Public Member Functions

 THash ()=default
 The default class constructor.
 THash (T hash)
 The class constructor with a given hash value.
 THash (const char *buffer, T base)
 The class constructor with a given char buffer.
 THash (T value, T base)
 The class constructor with a given unsigned int value.
 ~THash ()=default
 The class destructor.
T hashValue () const
 brief Returns the stored hash value.

Static Public Member Functions

static T toHash (const char *buffer, T base)
 Computes the hash value for a given character buffer.
static T toHash (T value, T base)
 Computes the hash value for a given unsigned int value.

Detailed Description

template<class T>
class cppcore::THash< T >

This class is used to calculate the hash value for a given integer or character buffer.

Definition at line 36 of file Hash.h.

Constructor & Destructor Documentation

◆ THash() [1/4]

template<class T>
cppcore::THash< T >::THash ( )
default

The default class constructor.

Referenced by THash(), and THash().

◆ THash() [2/4]

template<class T>
cppcore::THash< T >::THash ( T hash)
inlineexplicit

The class constructor with a given hash value.

Parameters
hash[in] An integer value to compute the hash from.

Definition at line 79 of file Hash.h.

◆ THash() [3/4]

template<class T>
cppcore::THash< T >::THash ( const char * buffer,
T base )
inlineexplicit

The class constructor with a given char buffer.

Parameters
value[in] A character buffer to compute the hash from.
base[in] The table base.

Definition at line 84 of file Hash.h.

References THash(), and toHash().

◆ THash() [4/4]

template<class T>
cppcore::THash< T >::THash ( T value,
T base )
inlineexplicit

The class constructor with a given unsigned int value.

Parameters
value[in] An unsigned int value to compute the hash from.
base[in] The table base.

Definition at line 89 of file Hash.h.

References THash(), and toHash().

◆ ~THash()

template<class T>
cppcore::THash< T >::~THash ( )
default

The class destructor.

Member Function Documentation

◆ hashValue()

template<class T>
T cppcore::THash< T >::hashValue ( ) const
inline

brief Returns the stored hash value.

Returns
The hash value.

Definition at line 116 of file Hash.h.

◆ toHash() [1/2]

template<class T>
T cppcore::THash< T >::toHash ( const char * buffer,
T base )
inlinestatic

Computes the hash value for a given character buffer.

Parameters
buffer[in] The buffer.
base[in] The table base.
Returns
The hash value.

Definition at line 94 of file Hash.h.

Referenced by cppcore::THashMap< T, U, TAlloc >::getValue(), cppcore::THashMap< T, U, TAlloc >::hasKey(), cppcore::THashMap< T, U, TAlloc >::insert(), cppcore::THashMap< T, U, TAlloc >::operator[](), cppcore::THashMap< T, U, TAlloc >::remove(), THash(), THash(), and cppcore::TStringBase< T >::TStringBase().

◆ toHash() [2/2]

template<class T>
T cppcore::THash< T >::toHash ( T value,
T base )
inlinestatic

Computes the hash value for a given unsigned int value.

Parameters
buffer[in] The unsigned int value.
base[in] The table base.
Returns
The hash value.

Definition at line 110 of file Hash.h.


The documentation for this class was generated from the following file:
  • include/cppcore/Common/Hash.h