ORIGINAL
Loading...
Searching...
No Matches
original::hash< TYPE > Class Template Reference

Forward declaration of hash class template. More...

#include <hash.h>

Collaboration diagram for original::hash< TYPE >:
Collaboration graph

Public Member Functions

u_integer operator() (const TYPE &t) const noexcept
 Hash function object call operator.
 
template<typename T>
original::u_integer hashFuncImpl (const T &t) noexcept
 
template<typename T>
original::u_integer hashFunc (const T &t) noexcept
 
template<typename T>
original::u_integer hashFunc (T *const &t) noexcept
 

Static Public Member Functions

static u_integer fnv1a (const byte *data, u_integer size) noexcept
 FNV-1a hash implementation for raw byte data.
 
template<typename T>
static u_integer hashFunc (const T &t) noexcept
 Default hash function fallback.
 
template<isHashable T>
static u_integer hashFunc (const T &t) noexcept
 Hash function for types satisfying the isHashable concept.
 
template<std::integral T>
static u_integer hashFunc (const T &t) noexcept
 Hash function specialization for integral types.
 
template<typename T>
static u_integer hashFunc (T *const &t) noexcept
 Hash function for pointers.
 
static u_integer hashFunc (const std::nullptr_t &null) noexcept
 Hash function for nullptr.
 
static u_integer hashFunc (const char &t) noexcept
 Hash function for single character.
 
static u_integer hashFunc (const char *str) noexcept
 Hash function for C-style strings.
 
static u_integer hashFunc (const std::string &str) noexcept
 Hash function for std::string.
 

Static Public Attributes

static constexpr u_integer FNV_OFFSET_BASIS = 0x811C9DC5
 FNV-1a initial offset value.
 
static constexpr u_integer FNV_32_PRIME = 0x01000193
 FNV-1a prime multiplier.
 

Friends

template<typename>
class hashable
 

Detailed Description

template<typename TYPE>
class original::hash< TYPE >

Forward declaration of hash class template.

Generic hash function object supporting multiple types.

Template Parameters
TYPEThe type for which the hash function object is defined.
TYPEThe type for which the hash function object is defined

Provides:

  • FNV-1a hash algorithm implementation
  • Specialized hash functions for common types
  • Fallback implementations for arbitrary types
  • Consistent hashing interface via operator()

Supported Types:

  • Integral types (direct casting)
  • Pointers (address-based hashing)
  • Strings (FNV-1a over characters)
  • Trivially copyable types (byte-wise hashing)
  • Types implementing hashable interface

Member Function Documentation

◆ fnv1a()

template<typename TYPE>
original::u_integer original::hash< TYPE >::fnv1a ( const byte * data,
u_integer size )
staticnoexcept

FNV-1a hash implementation for raw byte data.

Parameters
dataPointer to byte array
sizeNumber of bytes to hash
Returns
Computed hash value
Note
This is the fundamental hashing operation used by other specializations

◆ hashFunc() [1/8]

template<typename TYPE>
original::u_integer original::hash< TYPE >::hashFunc ( const char & t)
staticnoexcept

Hash function for single character.

Parameters
tCharacter to hash
Returns
Integer value of the character

◆ hashFunc() [2/8]

template<typename TYPE>
original::u_integer original::hash< TYPE >::hashFunc ( const char * str)
staticnoexcept

Hash function for C-style strings.

Parameters
strNull-terminated string
Returns
Computed FNV-1a hash
Note
Handles nullptr by returning 0

◆ hashFunc() [3/8]

template<typename TYPE>
original::u_integer original::hash< TYPE >::hashFunc ( const std::nullptr_t & null)
staticnoexcept

Hash function for nullptr.

Parameters
nullNull pointer
Returns
0 as the hash value

◆ hashFunc() [4/8]

template<typename TYPE>
original::u_integer original::hash< TYPE >::hashFunc ( const std::string & str)
staticnoexcept

Hash function for std::string.

Parameters
strString to hash
Returns
Computed FNV-1a hash

◆ hashFunc() [5/8]

template<typename TYPE>
template<typename T>
static u_integer original::hash< TYPE >::hashFunc ( const T & t)
staticnoexcept

Default hash function fallback.

Template Parameters
TThe input type
Parameters
tThe value to be hashed
Returns
Hash value

For trivially copyable types: uses byte-wise FNV-1a For other types: falls back to address hashing

◆ hashFunc() [6/8]

template<typename TYPE>
template<isHashable T>
static u_integer original::hash< TYPE >::hashFunc ( const T & t)
staticnoexcept

Hash function for types satisfying the isHashable concept.

Template Parameters
TA hashable type
Parameters
tThe object to hash
Returns
The hash value from the object's toHash method

◆ hashFunc() [7/8]

template<typename TYPE>
template<std::integral T>
static u_integer original::hash< TYPE >::hashFunc ( const T & t)
staticnoexcept

Hash function specialization for integral types.

Template Parameters
TIntegral type
Parameters
tThe value to hash
Returns
The casted hash value

◆ hashFunc() [8/8]

template<typename TYPE>
template<typename T>
static u_integer original::hash< TYPE >::hashFunc ( T *const & t)
staticnoexcept

Hash function for pointers.

Template Parameters
TThe pointee type
Parameters
tPointer to hash
Returns
Hash value based on address

◆ operator()()

template<typename TYPE>
original::u_integer original::hash< TYPE >::operator() ( const TYPE & t) const
noexcept

Hash function object call operator.

Parameters
tThe object to hash
Returns
Result of hashFunc
Note
Provides consistent interface for use in STL containers

The documentation for this class was generated from the following file: