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) (HashmapNode::HashmapNodeData *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 HashmapNode::HashmapNodeData *node) const
 Check if node belongs to hashmap. More...
 
HashmapNode::HashmapNodeDatafind_node (hashsum_t hash, const void *key, key_equals_callback callback) const
 Find node in the hashmap. More...
 
HashmapNode::HashmapNodeDatafront () const
 Get first node in hashmap. More...
 
HashmapNode::HashmapNodeDataback () const
 Get last node in hashmap. More...
 
HashmapNode::HashmapNodeDatanextof (HashmapNode::HashmapNodeData *node) const
 Get hashmap node next to given one. More...
 
bool insert (HashmapNode::HashmapNodeData *node, hashsum_t hash, const void *key, key_equals_callback callback)
 Insert node into hashmap. More...
 
void remove (HashmapNode::HashmapNodeData *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) (HashmapNode::HashmapNodeData *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()

HashmapNode::HashmapNodeData* 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 HashmapNode::HashmapNodeData node) const

Check if node belongs to hashmap.

◆ find_node()

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

Find node in the hashmap.

◆ front()

HashmapNode::HashmapNodeData* 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 ( HashmapNode::HashmapNodeData node,
hashsum_t  hash,
const void *  key,
key_equals_callback  callback 
)

Insert node into hashmap.

◆ nextof()

HashmapNode::HashmapNodeData* roc::core::HashmapImpl::nextof ( HashmapNode::HashmapNodeData node) const

Get hashmap node next to given one.

◆ remove()

void roc::core::HashmapImpl::remove ( HashmapNode::HashmapNodeData 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: