X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=vector%2Ftupleitem.h;h=37d5e248f99b41c73fa9748be9837a6a40346dda;hb=84fa20543ae0464a87fde599d1db66bfdbd29198;hp=baec9e3806d51e5d0897713d52d1f9b7169f5cb4;hpb=6f54a8281e4e5d6bc05e6b4eadc3327d5e48614a;p=rrq%2Frrqmisc.git diff --git a/vector/tupleitem.h b/vector/tupleitem.h index baec9e3..37d5e24 100644 --- a/vector/tupleitem.h +++ b/vector/tupleitem.h @@ -3,6 +3,11 @@ #include +/** + * A tuple is an array of void* + */ +typedef void *tuple[]; + /** * A tupleschema record declares the itemkeyfun functions for tuple * items together with applicable arity and domain combinations. The @@ -18,15 +23,17 @@ typedef struct { * provide the handling of the tuple columns. */ itemkeyfun functions; + /** * This is the number of columns in a tuple. */ int arity; + /** - * This is an array of pointers to the tuple item domains as - * represented by their associated itemkeyfun records. + * This points to an array of pointers to the tuple item domains + * as represented by their associated itemkeyfun records. */ - itemkeyfun **schema; + itemkeyfun **columns; } tupleschema; /** @@ -66,13 +73,30 @@ extern void *tupleitem_itemkey(itemkeyfun *this,void *item); */ extern void tupleitem_releasekey(itemkeyfun *this,void *key); +/** + * Create a tuples with given values. + */ +extern tuple *tuple_create(int arity,...); + +/** + * Create a tuples with given values. + */ +extern tupleschema *tupleschema_create(int arity,tuple *columns); + +/** + * Copy the given tupleschema into a new tupleschema with some columns + * masked. This represents a sub-index type using the unmasked columns + * for indexing. + */ +extern tupleschema *tupleschema_mask(tupleschema *schema,...); + /** * The TUPLEITEMINIT macro is used for initializing a tupleschema * record appropriately for a given arity and corresponding sequence * of parts itemkeyfun pointers. */ #define TUPLEITEMINIT(arity, ... ) { \ - functions = { \ + .functions = { \ .hashcode = tupleitem_hashcode, \ .haskey = tupleitem_haskey, \ .itemkey = tupleitem_itemkey, \