Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
|
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... | |
HashmapData * | find_node (hashsum_t hash, const void *key, key_equals_callback callback) const |
Find node in the hashmap. More... | |
HashmapData * | front () const |
Get first node in hashmap. More... | |
HashmapData * | back () const |
Get last node in hashmap. More... | |
HashmapData * | nextof (HashmapData *node) const |
Get hashmap node next to given one. More... | |
HashmapData * | prevof (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... | |
Intrusive hash table internal implementation.
Definition at line 30 of file hashmap_impl.h.
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.
roc::core::HashmapImpl::HashmapImpl | ( | void * | preallocated_data, |
size_t | num_embedded_buckets, | ||
IArena & | arena | ||
) |
Initialize empty hashmap.
roc::core::HashmapImpl::~HashmapImpl | ( | ) |
Deinitialize.
HashmapData* roc::core::HashmapImpl::back | ( | ) | const |
Get last node in hashmap.
size_t roc::core::HashmapImpl::capacity | ( | ) | const |
Get maximum number of nodes that can be added to hashmap before grow() should be called.
bool roc::core::HashmapImpl::contains | ( | const HashmapData * | node | ) | const |
Check if node belongs to hashmap.
HashmapData* roc::core::HashmapImpl::find_node | ( | hashsum_t | hash, |
const void * | key, | ||
key_equals_callback | callback | ||
) | const |
Find node in the hashmap.
HashmapData* roc::core::HashmapImpl::front | ( | ) | const |
Get first node in hashmap.
ROC_ATTR_NODISCARD bool roc::core::HashmapImpl::grow | ( | ) |
Grow hashtable capacity.
bool roc::core::HashmapImpl::insert | ( | HashmapData * | node, |
hashsum_t | hash, | ||
const void * | key, | ||
key_equals_callback | callback | ||
) |
Insert node into hashmap.
HashmapData* roc::core::HashmapImpl::nextof | ( | HashmapData * | node | ) | const |
Get hashmap node next to given one.
HashmapData* roc::core::HashmapImpl::prevof | ( | HashmapData * | node | ) | const |
Get hashmap node previous to given one.
void roc::core::HashmapImpl::remove | ( | HashmapData * | node, |
bool | skip_rehash | ||
) |
Remove node from hashmap.
size_t roc::core::HashmapImpl::size | ( | ) | const |
Get number of nodes added to hashmap.