00001
00010 #ifndef __CHASH_CHTBL_H__
00011 #define __CHASH_CHTBL_H__
00012
00013 #ifdef HAVE_CONFIG_H
00014 #include "config.h"
00015 #endif
00016
00017 #include <stdlib.h>
00018 #include <stdio.h>
00019 #include <string.h>
00020 #include "threading.h"
00021 #include "errmanager.h"
00022 #include "linklist.h"
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00042 typedef struct CHTbl_ {
00044 T_RDWR rwlock;
00045
00047 int buckets;
00048
00050 int (*h)(const void *key);
00051
00053 List *table;
00054
00055 } CHTbl;
00056
00057
00058
00059
00060
00061
00062
00073 int chtbl_init(CHTbl *htbl, int buckets, int (*h)(const void *key), int
00074 (*match)(const void *obj1, const void *obj2), void (*destroy)(void *obj));
00075
00076
00082 void chtbl_destroy(CHTbl *htbl);
00083
00084
00091 int chtbl_size(CHTbl *htbl);
00092
00093
00103 int chtbl_insert(CHTbl *htbl, const void *data);
00104
00105
00113 int chtbl_remove(CHTbl *htbl, void **data);
00114
00115
00123 int chtbl_lookup(CHTbl *htbl, void **data);
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133 #endif
00134