Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
roc::core::HashmapImpl Class Reference

Intrusive hash table internal implementation. More...

#include <hashmap_impl.h>

Classes

struct  Bucket
 Bucket container. More...
 

Public Types

enum  { LoadFactorNum = 13 , LoadFactorDen = 2 }
 
typedef bool(* key_equals_callback) (HashmapData *node, const void *key)
 Callback function pointer type for key equality check. More...
 

Public Member Functions

 HashmapImpl (void *preallocated_data, size_t num_embedded_buckets, IArena &arena)
 Initialize empty hashmap. More...
 
 ~HashmapImpl ()
 Deinitialize. More...
 
size_t capacity () const
 Get maximum number of nodes that can be added to hashmap before grow() should be called. More...
 
size_t size () const
 Get number of nodes added to hashmap. More...
 
bool contains (const HashmapData *node) const
 Check if node belongs to hashmap. More...
 
HashmapDatafind_node (hashsum_t hash, const void *key, key_equals_callback callback) const
 Find node in the hashmap. More...
 
HashmapDatafront () const
 Get first node in hashmap. More...
 
HashmapDataback () const
 Get last node in hashmap. More...
 
HashmapDatanextof (HashmapData *node) const
 Get hashmap node next to given one. More...
 
HashmapDataprevof (HashmapData *node) const
 Get hashmap node previous to given one. More...
 
bool insert (HashmapData *node, hashsum_t hash, const void *key, key_equals_callback callback)
 Insert node into hashmap. More...
 
void remove (HashmapData *node, bool skip_rehash)
 Remove node from hashmap. More...
 
ROC_ATTR_NODISCARD bool grow ()
 Grow hashtable capacity. More...
 

Detailed Description

Intrusive hash table internal implementation.

Definition at line 30 of file hashmap_impl.h.

Member Typedef Documentation

◆ key_equals_callback

typedef bool(* roc::core::HashmapImpl::key_equals_callback) (HashmapData *node, const void *key)

Callback function pointer type for key equality check.

Definition at line 45 of file hashmap_impl.h.

Constructor & Destructor Documentation

◆ HashmapImpl()

roc::core::HashmapImpl::HashmapImpl ( void *  preallocated_data,
size_t  num_embedded_buckets,
IArena arena 
)

Initialize empty hashmap.

◆ ~HashmapImpl()

roc::core::HashmapImpl::~HashmapImpl ( )

Deinitialize.

Member Function Documentation

◆ back()

HashmapData* roc::core::HashmapImpl::back ( ) const

Get last node in hashmap.

◆ capacity()

size_t roc::core::HashmapImpl::capacity ( ) const

Get maximum number of nodes that can be added to hashmap before grow() should be called.

◆ contains()

bool roc::core::HashmapImpl::contains ( const HashmapData node) const

Check if node belongs to hashmap.

◆ find_node()

HashmapData* roc::core::HashmapImpl::find_node ( hashsum_t  hash,
const void *  key,
key_equals_callback  callback 
) const

Find node in the hashmap.

◆ front()

HashmapData* roc::core::HashmapImpl::front ( ) const

Get first node in hashmap.

◆ grow()

ROC_ATTR_NODISCARD bool roc::core::HashmapImpl::grow ( )

Grow hashtable capacity.

◆ insert()

bool roc::core::HashmapImpl::insert ( HashmapData node,
hashsum_t  hash,
const void *  key,
key_equals_callback  callback 
)

Insert node into hashmap.

◆ nextof()

HashmapData* roc::core::HashmapImpl::nextof ( HashmapData node) const

Get hashmap node next to given one.

◆ prevof()

HashmapData* roc::core::HashmapImpl::prevof ( HashmapData node) const

Get hashmap node previous to given one.

◆ remove()

void roc::core::HashmapImpl::remove ( HashmapData node,
bool  skip_rehash 
)

Remove node from hashmap.

◆ size()

size_t roc::core::HashmapImpl::size ( ) const

Get number of nodes added to hashmap.


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