|
Grok 20.3.2
|
Thread-safe min-heap for pointers with customizable locking. More...
#include <MinHeap.h>
Public Member Functions | |
| void | push (T *val) |
| Pushes a pointer onto the heap. | |
| std::vector< T * > | pop (T *val) |
| Optionally pushes a pointer 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 * >, MinHeapPtrComparator< 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 pointers with customizable locking.
| T | Type pointed to, must satisfy HasGetIndex. |
| IT | Integral type for indexing (e.g., int, size_t). |
| L | Locker type (e.g., MinHeapLocker or MinHeapFakeLocker). |
|
inline |
Optionally pushes a pointer and pops all consecutive elements starting from 'start'.
| val | Pointer to push (nullptr means no push). |
References queue, grk::MinHeapBase< IT >::queue_mutex, and grk::MinHeapBase< IT >::start.
|
inline |
Pushes a pointer onto the heap.
| val | Pointer to the value to add (ownership not taken). |
References queue, and grk::MinHeapBase< IT >::queue_mutex.
|
inline |
Returns the current size of the heap.
References queue, and grk::MinHeapBase< IT >::queue_mutex.
|
private |