Coconut Framework  beta
CNHashTable.h
Go to the documentation of this file.
1 
8 #ifndef CNHASHTABLE_H
9 #define CNHASHTABLE_H
10 
11 #include "CNType.h"
12 #include <stdint.h>
13 
15 #define CNArraySizeOfHashTable 256
16 
18 struct CNHashTableItem ;
19 
21 typedef uint64_t (*CNCalcHashItemFuncRef)(const void * obj, void * info) ;
22 
28 {
37 } ;
38 
43 {
45  struct CNResource * resource ;
49  struct CNHashTableItem * tableItems[CNArraySizeOfHashTable] ;
50 } ;
51 
58 void
59 CNInitHashTable(struct CNHashTable * dst, const struct CNHashTableMethods * methods, struct CNResource * resource) ;
60 
66 void
67 CNDestroyHashTable(struct CNHashTable * dst, void * info) ;
68 
77 const void *
78 CNSearchHashTable(const struct CNHashTable * table, const void * src, void * info) ;
79 
87 const void *
88 CNAddToHashTable(struct CNHashTable * table, const void * src, void * info) ;
89 
90 #endif /* CNHASHTABLE_H */
91 
uint64_t(* CNCalcHashItemFuncRef)(const void *obj, void *info)
Function to calc hash value of item in CNHashTable.
Definition: CNHashTable.h:21
CNCalcHashItemFuncRef calcHashFunc
Function to calculate hash value.
Definition: CNHashTable.h:30
CNDestroyDataFuncRef destroyHashFunc
Function to destroy item.
Definition: CNHashTable.h:36
void(* CNDestroyDataFuncRef)(void *src, void *info, struct CNResource *resource)
Function to destroy item.
Definition: CNType.h:31
CNCompareDataFuncRef compareHashFunc
Function to compare items.
Definition: CNHashTable.h:32
CNCloneDataFuncRef cloneHashFunc
Function to clone items.
Definition: CNHashTable.h:34
void CNDestroyHashTable(struct CNHashTable *dst, void *info)
Destroy all contexts in CNHashTable.
struct CNResource * resource
Resource for hash table.
Definition: CNHashTable.h:45
void CNInitHashTable(struct CNHashTable *dst, const struct CNHashTableMethods *methods, struct CNResource *resource)
Initialize CNHashTable.
Hash table for any data.
Definition: CNHashTable.h:42
#define CNArraySizeOfHashTable
Array size of CNHashTable.
Definition: CNHashTable.h:15
struct CNHashTableItem * tableItems[CNArraySizeOfHashTable]
Array to store items.
Definition: CNHashTable.h:49
struct CNHashTableMethods * tableMethods
Methods to operate items in hash table.
Definition: CNHashTable.h:47
Define primitive data types.
Set of methods for item in CNHashTable These functions are called in CNHashTable. ...
Definition: CNHashTable.h:27
const void * CNSearchHashTable(const struct CNHashTable *table, const void *src, void *info)
Search item in CNHashTable.
const void * CNAddToHashTable(struct CNHashTable *table, const void *src, void *info)
Add item to CNHashTable.
int(* CNCompareDataFuncRef)(const void *s0, const void *s1, void *info)
Function to compare items in CNHashTable.
Definition: CNType.h:22
void *(* CNCloneDataFuncRef)(const void *src, void *info, struct CNResource *resource)
Function to clone the source data.
Definition: CNType.h:28