name: SysHeap

synopsis:

g++ [flags ...] file ... -l /isip/tools/lib/$ISIP_BINARY/lib_system.a

#include <SysHeap.h>

boolean insert(void* ptr);
boolean extractMax(void*& ptr);
boolean extract(void* ptr);
boolean build();
quick start:

// declare a heap object
//
SysHeap heap;

// set the length of heap
//
heap.setLength(10);

// give values to heap
//
heap.data_d[0] = (void*)8;
heap.data_d[1] = (void*)14;
heap.data_d[2] = (void*)7;
heap.data_d[3] = (void*)11;
heap.data_d[4] = (void*)10;
heap.data_d[5] = (void*)1;
heap.data_d[6] = (void*)4;
heap.data_d[7] = (void*)2;
heap.data_d[8] = (void*)3;
heap.data_d[9] = (void*)9;

// declare a pointer
//
void* ptr_ins;

// insert this pointer into heap
//
ptr_ins = (void*)12;
heap.insert(ptr_ins);
description:

The SysHeap class implements a heap for pointers. The insert and extract methods are the most useful methods. The insert method adds a pointer to the heap and the extract method removes a pointer from the heap. The extractMax method, on the other hand, removes and returns the largest pointer from the heap.

The binary heap data structure is an array that can be viewed as a complete binary tree. Each node of the tree corresponds to an element of the array that stores the value in the node. The tree is completely filled on all levels except possibly the lowest, which is filled from the left up to a point.

If an array A is used to represents a heap, A[0] is the root of the tree. Also, given the index i of a node the following indices can be found: A good tutorial on heaps can be found at :
dependencies:

public constants:

error codes:

protected data:

required public methods:

class-specific public methods:

private methods:

examples:

notes: