9 * itemkeyfun provides a meta-level representation for abstracting
10 * items as pairs of keys and payload, and having a hashcode mapping
11 * for keys. The key part is used for identifying items under the idea
12 * that all items that have the same key are the same; distinct
13 * representations of the same abstract entity. The hashcode scrambles
14 * the key part in a consistent way into an ideal table index for the
15 * items that have that key. Different keys may yield the same
20 #define SELF void *this
22 * This callback function should return the hashcode of a key. The
23 * hashcode is used for indexing into the backing vector for
24 * finding the an item via its key. The same key must map
25 * consistently to the same hashcode while the hashtable contains
26 * an item with that key. Different keys map map to the same
27 * hashcode, in which case the vector placement is made at the
28 * first empty or hole slot following the hashcode index.
30 unsigned long (*hashcode)(SELF,void *key);
33 * This callback function should determine whether an item has a
36 int (*haskey)(SELF,void *item,void *key);
39 * This callback function should return a (possibly temporary) key
40 * of an item. It can be anything (i.e., with or without internal
41 * structure) as it is treated as an identifier that other
42 * callbacks recognize. It is merely understood as a value in an
45 void *(*itemkey)(SELF,void *item);
48 * This callback function should handle a key obtained from the
49 * itemkey callback function, e.g., reclaim temporary allocation.
51 void (*releasekey)(SELF,void *key);
54 * This callback function writes a representation of an item into
57 int (*tostring)(SELF,void *item,char *buffer,int limit);