ON_Hash32Table Class Reference

A hash table designed to be used for items with high quality 32-bit hash values. More...

#include <opennurbs_hash_table.h>

Public Member Functions

 ON_Hash32Table ()
 
 ~ON_Hash32Table ()
 
bool AddItem (ON__UINT32 hash32, class ON_Hash32TableItem *item)
 Adds an item to the hash table. More...
 
class ON_Hash32TableItemFirstItemWithHash (ON__UINT32 hash32) const
 
class ON_Hash32TableItemFirstTableItem () const
 
ON__UINT32 HashTableSerialNumber () const
 
bool IsValid () const
 
unsigned int ItemCount () const
 
class ON_Hash32TableItemNextItemWithHash (const class ON_Hash32TableItem *current_item) const
 
class ON_Hash32TableItemNextTableItem (const ON_Hash32TableItem *item) const
 
unsigned int RemoveAllItems ()
 Removes all hash table items. Caller is responsible for managing the item memory. More...
 
unsigned int RemoveAllItems (class ON_FixedSizePool &fsp)
 Removes all hash table items. For each item memset(item,0,fsp.SizeofElement()) and fsp.ReturnElement(item) are called. More...
 
bool RemoveItem (class ON_Hash32TableItem *item)
 Remove an item from the hash table. Caller is responsible for managing item memory. More...
 

Detailed Description

A hash table designed to be used for items with high quality 32-bit hash values.

Constructor & Destructor Documentation

◆ ON_Hash32Table()

ON_Hash32Table::ON_Hash32Table ( )

◆ ~ON_Hash32Table()

ON_Hash32Table::~ON_Hash32Table ( )

Member Function Documentation

◆ AddItem()

bool ON_Hash32Table::AddItem ( ON__UINT32  hash32,
class ON_Hash32TableItem item 
)

Adds an item to the hash table.

Parameters
hash32[in]
item[in/out]
Returns
The added item.

◆ FirstItemWithHash()

class ON_Hash32TableItem* ON_Hash32Table::FirstItemWithHash ( ON__UINT32  hash32) const
Parameters
hash32[in]
Returns
The first item in the hash table with hash = hash32.

This function is used to find the first element in the hash table with the specified hash32 falue. Use ON_Hash32TableItem.NextItemWithSameHash() to get the next item in the has table with the same hash value.

◆ FirstTableItem()

class ON_Hash32TableItem* ON_Hash32Table::FirstTableItem ( ) const
Returns
The first item in the hash table.

This function is used for iterating throught every element in the hash table.

◆ HashTableSerialNumber()

ON__UINT32 ON_Hash32Table::HashTableSerialNumber ( ) const

◆ IsValid()

bool ON_Hash32Table::IsValid ( ) const

◆ ItemCount()

unsigned int ON_Hash32Table::ItemCount ( ) const
Returns
Number of items in the hash table

◆ NextItemWithHash()

class ON_Hash32TableItem* ON_Hash32Table::NextItemWithHash ( const class ON_Hash32TableItem current_item) const

◆ NextTableItem()

class ON_Hash32TableItem* ON_Hash32Table::NextTableItem ( const ON_Hash32TableItem item) const
Returns
The next item in the hash table.

This function is used for iterating throught every element in the hash table.

◆ RemoveAllItems() [1/2]

unsigned int ON_Hash32Table::RemoveAllItems ( )

Removes all hash table items. Caller is responsible for managing the item memory.

◆ RemoveAllItems() [2/2]

unsigned int ON_Hash32Table::RemoveAllItems ( class ON_FixedSizePool fsp)

Removes all hash table items. For each item memset(item,0,fsp.SizeofElement()) and fsp.ReturnElement(item) are called.

◆ RemoveItem()

bool ON_Hash32Table::RemoveItem ( class ON_Hash32TableItem item)

Remove an item from the hash table. Caller is responsible for managing item memory.

Parameters
item[in/out] If the item is removed, the has table serial number is set to zero.
Returns
The true if the item was removed.