The LevAWC Project
 All Data Structures Files Functions Variables Typedefs Enumerations Macros Pages
heap.h
Go to the documentation of this file.
1 /*
2  * _____
3  * ANSI / ___/
4  * / /__
5  * \___/
6  *
7  * Filename: heap.h
8  * Author : Kyle Loudon/Dan Levin
9  * Date : Fri Mar 22 12:40:45 GMT 2013
10  * Version : 0.51
11  * ---
12  * Description: A heap ADT - written in ANSI C.
13  *
14  * Revision history - coming up below:
15  *
16  * Date Revision message
17  * 130217 Created this file
18  * 150331 This code ready for version 0.51
19  *
20  */
25 #ifndef _HEAP_H_
26 #define _HEAP_H_
27 
28 #include <stdio.h>
29 #include <stdlib.h>
30 #include <string.h>
31 #include <assert.h>
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
42  typedef struct Heap_ *Heap;
43 
44  /* FUNCTION DECLARATIONS */
45 
68  Heap HEAPinit(int (*compare)(const void *key1, const void* key2), void (*destroy)(void *data));
69 
88  void HEAPdestroy(Heap hp);
89 
105  int HEAPinsert(Heap hp, const void *data);
106 
116  const void *HEAPpeek(Heap hp);
117 
140  int HEAPextract(Heap hp, void **data);
141 
150  int HEAPsize(Heap hp);
151 
166  void HEAPprint(Heap hp, void (*callback)(const void *data));
167 
168 
169 #ifdef __cplusplus
170 }
171 #endif
172 
173 #endif /* _HEAP_H_ */