src/heap/heap.h File Reference

#include "util.h"
Include dependency graph for heap.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define Heap_HeapForEachItem(heap,i,data)

Typedefs

typedef struct HeapSlot HeapSlot_t
typedef struct Heap Heap_t

Functions

EXTERN Heap_t *Heap_HeapInit ARGS ((int length))
EXTERN Heap_t *Heap_HeapInitCompare ARGS ((int length, int(*compare)(const void *, const void *)))
EXTERN void Heap_HeapFree ARGS ((Heap_t *heap))
EXTERN int Heap_HeapInsert ARGS ((Heap_t *heap, void *item, long key))
EXTERN int Heap_HeapExtractMin ARGS ((Heap_t *heap, void *item, long *key))
EXTERN Heap_t *Heap_HeapClone ARGS ((Heap_t *source))
EXTERN void Heap_HeapApplyForEachElement (Heap_t *heap, int(*compare)(const void *))

Define Documentation

#define Heap_HeapForEachItem ( heap,
i,
data   ) 
Value:
for((i) = 0; (((i) < (heap)->nitems) && (data = (heap)->slots[i].item)); \
      (i)++)

Macro***********************************************************************

Synopsis [Iterates over the elements of a heap.]

SideEffects [none]

Definition at line 78 of file heap.h.


Typedef Documentation

typedef struct Heap Heap_t

Definition at line 56 of file heap.h.

typedef struct HeapSlot HeapSlot_t

CFile***********************************************************************

FileName [heap.h]

PackageName [heap]

Synopsis [Heap-based priority queue.]

Description [This is the external header file for the heap-based priority queue. The priority of each item is determined by an integer key. The first element of the heap is the one with the smallest key. Multiple items with the same key can be inserted. Refer to Chapter 7 of Cormen, Leiserson, and Rivest for the theory. (The only significant difference is that the array indices start from 0 in this implementation.)]

SeeAlso []

Author [Fabio Somenzi]

Copyright [This file was created at the University of Colorado at Boulder. The University of Colorado at Boulder makes no warranty about the suitability of this software for any purpose. It is presented on an AS IS basis.]

Revision [

Id
heap.h,v 1.13 2005/05/18 19:25:43 jinh Exp

]

Definition at line 54 of file heap.h.


Function Documentation

EXTERN Heap_t* Heap_HeapClone ARGS ( (Heap_t *source)   ) 
EXTERN int Heap_HeapExtractMin ARGS ( (Heap_t *heap, void *item, long *key)   ) 
EXTERN int Heap_HeapInsertCompare ARGS ( (Heap_t *heap, void *item, long key)   ) 
EXTERN int Heap_HeapTestCompare ARGS ( (Heap_t *heap)   ) 
EXTERN Heap_t* Heap_HeapInitCompare ARGS ( (int length, int(*compare)(const void *, const void *))   ) 
EXTERN Heap_t* Heap_HeapInit ARGS ( (int length)   ) 

AutomaticStart

EXTERN void Heap_HeapApplyForEachElement ( Heap_t heap,
int(*)(const void *)  compare 
)

Function********************************************************************

Synopsis [Apply function for each element of heap.]

Description [Apply function for each element of heap. Returns 1 if successful; 0 otherwise.]

SideEffects [ ]

SeeAlso [ ]

Definition at line 537 of file heap.c.

00538 {
00539 int i;
00540 
00541   for(i=0; i<heap->nitems; i++) {
00542     (*compare)(heap->slots[i].item);
00543   }
00544   return;
00545 }


Generated on Tue Jan 12 13:57:24 2010 for glu-2.2 by  doxygen 1.6.1