class Heap


 
LOGO
 Annotated List  Files  Globals  Hierarchy  Index  Top

Public Methods


Detailed Description

 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]

Destructor

void  push (Heap_Key k, HeapBase *p)

push

Push an object into the heap by using a sorting key.

Parameters:

kthe sorting key.
pthe 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:

ithe 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_keythe new key.
objectthe 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:

pthe object to remove if not NULL, otherwise the top element from the heap.
void  heapify ()

heapify

Rebuild the heap structure.

void  print ()

print

void  print_all (int)

print_all


Generated by: pavlin on possum.icir.org on Wed Aug 2 15:35:43 2006, using kdoc $.