0923bcd736addd2bcdafe9ad9b6badc07a89f7e0
[rrq/rrqmisc.git] / vector / stringitem.h
1 #ifndef stringitem_H
2 #define stringitem_H
3
4 #include <itemkeyfun.h>
5
6 /**
7  * The stringitem record declares the itemkeyfun functions for string
8  * items.
9  */
10 extern itemkeyfun stringitem;
11
12 /**
13  * This callback function returns the hashcode of a key. The hashcode
14  * is used for indexing into the backing vector for finding the an
15  * item via its key. The same key must map consistently to the same
16  * hashcode while the hashtable contains an item with that key.
17  * Different keys map map to the same hashcode, in which case the
18  * vector placement is made at the first empty or hole slot following
19  * the hashcode index.
20  */
21 extern unsigned long stringitem_hashcode(itemkeyfun *this,void *key);
22
23 /**
24  * This callback function determines whether an item has a
25  * given key or not.
26  */
27 extern int stringitem_haskey(itemkeyfun *this,void *item,void *key);
28
29 /**
30  * This callback function returns the key of an item by considering
31  * the arity and schema.
32  */
33 extern void *stringitem_itemkey(itemkeyfun *this,void *item);
34
35 /**
36  * This callback function handles a key obtained from the itemkey
37  * callback function to reclaim temporary allocation.
38  */
39 extern void stringitem_releasekey(itemkeyfun *this,void *key);
40
41
42 #endif