OpenTTD Source 20260206-master-g4d4e37dbf1
HashTableSlot< TItem > Struct Template Reference

Public Types

typedef TItem::Key Key

Public Member Functions

void Clear ()
 hash table slot helper - clears the slot by simple forgetting its items
const TItem * Find (const Key &key) const
 hash table slot helper - linear search for item with given key through the given blob - const version
TItem * Find (const Key &key)
 hash table slot helper - linear search for item with given key through the given blob - non-const version
void Attach (TItem &new_item)
 hash table slot helper - add new item to the slot
bool Detach (TItem &item_to_remove)
 hash table slot helper - remove item from a slot
TItem * Detach (const Key &key)
 hash table slot helper - remove and return item from a slot

Data Fields

TItem * first_item = nullptr

Detailed Description

template<class TItem>
struct HashTableSlot< TItem >

Definition at line 14 of file hashtable.hpp.

Member Typedef Documentation

◆ Key

template<class TItem>
typedef TItem::Key HashTableSlot< TItem >::Key

Definition at line 16 of file hashtable.hpp.

Member Function Documentation

◆ Attach()

template<class TItem>
void HashTableSlot< TItem >::Attach ( TItem & new_item)
inline

hash table slot helper - add new item to the slot

Definition at line 51 of file hashtable.hpp.

Referenced by HashTable< Titem, Thash_bits_ >::Push().

◆ Clear()

template<class TItem>
void HashTableSlot< TItem >::Clear ( )
inline

hash table slot helper - clears the slot by simple forgetting its items

Definition at line 21 of file hashtable.hpp.

◆ Detach() [1/2]

template<class TItem>
TItem * HashTableSlot< TItem >::Detach ( const Key & key)
inline

hash table slot helper - remove and return item from a slot

Definition at line 81 of file hashtable.hpp.

◆ Detach() [2/2]

template<class TItem>
bool HashTableSlot< TItem >::Detach ( TItem & item_to_remove)
inline

hash table slot helper - remove item from a slot

Definition at line 59 of file hashtable.hpp.

Referenced by HashTable< Titem, Thash_bits_ >::TryPop(), and HashTable< Titem, Thash_bits_ >::TryPop().

◆ Find() [1/2]

template<class TItem>
TItem * HashTableSlot< TItem >::Find ( const Key & key)
inline

hash table slot helper - linear search for item with given key through the given blob - non-const version

Definition at line 39 of file hashtable.hpp.

◆ Find() [2/2]

template<class TItem>
const TItem * HashTableSlot< TItem >::Find ( const Key & key) const
inline

hash table slot helper - linear search for item with given key through the given blob - const version

Definition at line 27 of file hashtable.hpp.

Referenced by HashTable< Titem, Thash_bits_ >::Find(), HashTable< Titem, Thash_bits_ >::Find(), and HashTable< Titem, Thash_bits_ >::Push().

Field Documentation

◆ first_item

template<class TItem>
TItem* HashTableSlot< TItem >::first_item = nullptr

Definition at line 18 of file hashtable.hpp.


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