Heap ()
| Heap |
Default constructor used to build a standard heap with no support for removal from the middle.
explicit Heap (bool)
| Heap |
Constructor used to build a standard heap with support for removal from the middle. Should be used with something like:
struct _foo { ... ; int my_index ; ... } x; ... Heap *h = new Heap (OFFSET_OF(x, my_index));
~Heap ()
| ~Heap |
[virtual]
void push (Heap_Key k, HeapBase *p)
| push |
Push an object into the heap by using a sorting key.
Parameters:
k | the sorting key. |
p | the object to push into the heap. |
void push (int i)
| push |
Bubble-up an object in the heap.
Note: this probably should not be exposed.
Parameters:
i | the offset of the object to bubble-up. |
void move (Heap_Key new_key, HeapBase *object)
| move |
Move an object in the heap according to the new key. Note: can only be used if the heap supports removal from the middle.
Parameters:
new_key | the new key. |
object | the object to move. |
struct heap_entry * top ()
| top |
[const]
Get a pointer to the entry at the top of the heap.
Both the key and the value can be derived from the return value.
Returns: the pointer to the entry at the top of the heap.
size_t size ()
| size |
[const]
Get the number of elements in the heap.
Returns: the number of elements in the heap.
void pop ()
| pop |
Remove the object top of the heap.
void pop_obj (HeapBase *p)
| pop_obj |
Remove an object from an arbitrary position in the heap.
Note: only valid if the heap supports this kind of operation.
Parameters:
p | the object to remove if not NULL, otherwise the top element from the heap. |
void heapify ()
| heapify |
void print ()
|
void print_all (int)
| print_all |