The LevAWC Project
 All Data Structures Files Functions Variables Typedefs Enumerations Macros Pages
chashtbl.h
Go to the documentation of this file.
1 /*
2  * _____
3  * ANSI / ___/
4  * / /__
5  * \___/
6  *
7  * Filename: chashtbl.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 chained hash table - implemented as a pure, generic ADT container.
13  *
14  * Revision history - coming up below:
15  *
16  * Date Revision message
17  * 2013-01-30 Created this file initially
18  * 2013-02-19 Made some revision to the Doxygen documentation. Enhanced the description of
19  * in/out parameters - i.e. double-pointers.
20  * 2013-03-21 Minor documentation clarifications.
21  * 2015-03-31 This code ready for version 0.51
22  *
23  */
24 
29 #ifndef _CHASHTBL_H_
30 #define _CHASHTBL_H_
31 
32 #include <stdio.h>
33 #include <stdlib.h>
34 #include <string.h>
35 
36 #include "slist.h"
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
47  typedef struct CHtbl_ *CHtbl;
48 
49  /* FUNCTION DECLARATIONS */
50 
51 
75  CHtbl CHTBLinit(int buckets,
76  int (*h)(const void *key),
77  int (*match)(const void *key1, const void *key2),
78  void (*destroy)(void *data));
79 
96  void CHTBLdestroy(CHtbl htbl);
97 
114  int CHTBLinsert(CHtbl htbl, const void *data);
115 
147  int CHTBLremove(CHtbl htbl, void **data);
148 
177  int CHTBLlookup(const CHtbl htbl, void **data);
178 
187  int CHTBLsize(CHtbl htbl);
188 
203  void CHTBLprint(CHtbl htbl, void (*callback)(const void *data));
204 
205 
206 #ifdef __cplusplus
207 }
208 #endif
209 
210 #endif /* _CHASHTBL_H_ */
211