4 #include <itemkeyfun.h>
7 * A tupleschema record declares the itemkeyfun functions for tuple
8 * items together with applicable arity and domain combinations. The
9 * macro \ref TUPLEITEMINIT may be used to initialize particular
10 * tupleschema records, which each become tupleitem declaration for
11 * its particular arity and parts declarations
15 * These are the itemkeyfun callback functions to support
16 * hashvector use for tuple items. The functions expects their
17 * itemkeyfun pointer to be within a tupleschema record so as to
18 * provide the handling of the tuple columns.
22 * This is the number of columns in a tuple.
26 * This is an array of pointers to the tuple item domains as
27 * represented by their associated itemkeyfun records.
33 * This callback function returns the hashcode of a key.
35 * \param this is a pointer to the itemkeyfun record from where this
36 * callback got invoked
38 * \param key is the key to produce a hascode for
40 * \returns the hashcode which is a vector_index (i.e. unsigned long)
42 * The hashcode is used for indexing into the backing vector for
43 * finding the an item via its key. The same key must map consistently
44 * to the same hashcode while the hashtable contains an item with that
45 * key. Different keys map map to the same hashcode, in which case the
46 * vector placement is made at the first empty or hole slot following
49 extern unsigned long tupleitem_hashcode(itemkeyfun *this,void *key);
52 * This callback function determines whether an item has a
55 extern int tupleitem_haskey(itemkeyfun *this,void *item,void *key);
58 * This callback function returns the key of an item by considering
59 * the arity and schema.
61 extern void *tupleitem_itemkey(itemkeyfun *this,void *item);
64 * This callback function handles a key obtained from the itemkey
65 * callback function to reclaim temporary allocation.
67 extern void tupleitem_releasekey(itemkeyfun *this,void *key);
70 * The TUPLEITEMINIT macro is used for initializing a tupleschema
71 * record appropriately for a given arity and corresponding sequence
72 * of parts itemkeyfun pointers.
74 #define TUPLEITEMINIT(arity, ... ) { \
76 .hashcode = tupleitem_hashcode, \
77 .haskey = tupleitem_haskey, \
78 .itemkey = tupleitem_itemkey, \
79 .releasekey = tupleitem_releasekey \
82 .schema = { __VA_ARGS__ } \