Ult3D
Implementation of "Ultimate 3D Game Engine Design & Architecture" by Allan Sherrod
Loading...
Searching...
No Matches
Ult::HashTable< T > Class Template Reference

#include <HashTable.h>

Public Member Functions

 HashTable (int size)
 
 ~HashTable ()
 
void Insert (const HashItem< T > &obj)
 
void Delete (const int key)
 
HashItem< T > Find (int key)
 
int HashFunction (const int key) const
 
int HashFunction (const std::string &str)
 
int GetSize () const
 

Detailed Description

template<typename T>
class Ult::HashTable< T >

Stores a group of key-value pairs where the values of are type T. Each key-value pair is a HashItem.

Constructor & Destructor Documentation

◆ HashTable()

template<typename T>
Ult::HashTable< T >::HashTable ( int size)
inline

HashTable constructor.

Parameters
sizeThe number of entries for hashes. Each hash can hold multiple objects.

◆ ~HashTable()

template<typename T>
Ult::HashTable< T >::~HashTable ( )
inline

HashTable destructor.

Member Function Documentation

◆ Delete()

template<typename T>
void Ult::HashTable< T >::Delete ( const int key)
inline

Remove the HashItem with the given key from the table if found.

◆ Find()

template<typename T>
HashItem< T > Ult::HashTable< T >::Find ( int key)
inline

Returns a HashItem with the given key if found. If not found, the HashItem key is set to -1.

◆ GetSize()

template<typename T>
int Ult::HashTable< T >::GetSize ( ) const
inline

Returns the size of the HashTable.

◆ HashFunction() [1/2]

template<typename T>
int Ult::HashTable< T >::HashFunction ( const int key) const
inline

The has function for an int key, which is the key modulo the table size.

◆ HashFunction() [2/2]

template<typename T>
int Ult::HashTable< T >::HashFunction ( const std::string & str)
inline

Calculates the integer hash key for the given input string.

◆ Insert()

template<typename T>
void Ult::HashTable< T >::Insert ( const HashItem< T > & obj)
inline

Add the input HashItem into the table.


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