|
Grok 20.3.2
|
Thread-safe min-heap for values with customizable locking. More...
#include <MinHeap.h>
Public Member Functions | |
| void | push (const T &val) |
| Pushes a value onto the heap. | |
| std::vector< T > | push_and_pop (const T &val) |
| Pushes a value and pops all consecutive elements starting from 'start'. | |
| size_t | size () const |
| Returns the current size of the heap. | |
Private Attributes | |
| std::priority_queue< T, std::vector< T >, MinHeapComparator< T > > | queue |
| Underlying min-heap. | |
Additional Inherited Members | |
| Protected Member Functions inherited from grk::MinHeapBase< IT > | |
| MinHeapBase () | |
| Protected Attributes inherited from grk::MinHeapBase< IT > | |
| std::mutex | queue_mutex |
| Mutex for thread-safe access. | |
| IT | start |
| Tracks the next expected index for sequential popping. | |
Thread-safe min-heap for values with customizable locking.
| T | Type stored in the heap, must satisfy HasGetIndex. |
| IT | Integral type for indexing (e.g., int, size_t). |
| L | Locker type (e.g., MinHeapLocker or MinHeapFakeLocker). |
|
inline |
Pushes a value onto the heap.
| val | The value to add. |
References queue, and grk::MinHeapBase< IT >::queue_mutex.
|
inline |
Pushes a value and pops all consecutive elements starting from 'start'.
| val | The value to push. |
References queue, grk::MinHeapBase< IT >::queue_mutex, and grk::MinHeapBase< IT >::start.
|
inline |
Returns the current size of the heap.
References queue, and grk::MinHeapBase< IT >::queue_mutex.
|
private |
Underlying min-heap.
Referenced by push(), push_and_pop(), and size().