QUARK
0.9.0
QUARK-QUeuingAndRuntimeforKernels
Main Page
Modules
Data Types List
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
icl_hash.h
Go to the documentation of this file.
1
7
/* $Id$ */
8
/* $UTK_Copyright: $ */
9
10
#ifndef icl_hash_h
11
#define icl_hash_h
12
13
#if defined(c_plusplus) || defined(__cplusplus)
14
extern
"C"
{
15
#endif
16
17
typedef
struct
icl_entry_s
{
18
void
*
key
;
19
void
*
data
;
20
struct
icl_entry_s
*
next
;
21
}
icl_entry_t
;
22
23
typedef
struct
icl_hash_s
{
24
int
nbuckets
;
25
int
nentries
;
26
icl_entry_t
**
buckets
;
27
unsigned
int (*
hash_function
)(
void
*);
28
int (*
hash_key_compare
)(
void
*,
void
*);
29
}
icl_hash_t
;
30
31
icl_hash_t
*
32
icl_hash_create
(
int
nbuckets,
unsigned
int
(*hash_function)(
void
*),
int
(*hash_key_compare)(
void
*,
void
*) );
33
34
void
35
*
icl_hash_find
(
icl_hash_t
*,
void
* );
36
37
icl_entry_t
38
*
icl_hash_insert
(
icl_hash_t
*,
void
*,
void
*),
39
*
icl_hash_update_insert
(
icl_hash_t
*,
void
*,
void
*,
void
**);
40
41
int
42
icl_hash_destroy
(
icl_hash_t
*,
void
(*)(
void
*),
void
(*)(
void
*)),
43
icl_hash_dump
(FILE *,
icl_hash_t
*);
44
45
int
icl_hash_delete
(
icl_hash_t
*ht,
void
* key,
void
(*free_key)(
void
*),
void
(*free_data)(
void
*) );
46
47
48
#define icl_hash_foreach(ht, tmpint, tmpent, kp, dp) \
49
for (tmpint=0;tmpint<ht->nbuckets; tmpint++) \
50
for (tmpent=ht->buckets[tmpint]; \
51
tmpent!=NULL&&((kp=tmpent->key)!=NULL)&&((dp=tmpent->data)!=NULL); \
52
tmpent=tmpent->next)
53
54
55
#if defined(c_plusplus) || defined(__cplusplus)
56
}
57
#endif
58
59
#endif
/* icl_hash_h */
quark-0.9.0
icl_hash.h
Generated on Wed Jun 27 2012 12:20:20 for QUARK by
1.8.1