Cleanup Tuple to allow self-typing.
[rrq/rrqmisc.git] / vector / TupleSchema.h
index 4f5a544bfd54fde656ab3180181e75cac44e8859..72fdc1e5bdc28a5059280c5576a1e042a7477202 100644 (file)
@@ -1,12 +1,7 @@
 #ifndef tupleitem_H
 #define tupleitem_H
 
-#include <ItemKeyFun.h>
-
-/**
- * A tuple is an array of void*
- */
-typedef void *tuple[];
+#include <Tuple.h>
 
 /**
  * A TupleSchema record declares the ItemKeyFun functions for tuple
@@ -16,7 +11,7 @@ typedef void *tuple[];
  *
  * \extends ItemKeyFun
  */
-typedef struct {
+typedef struct TupleSchema {
     /**
      * These are the ItemKeyFun callback functions to support
      * HashVector use for tuple items. The functions expects their
@@ -31,10 +26,11 @@ typedef struct {
     int arity;
 
     /**
-     * This points to an array of pointers to the tuple item domains
-     * as represented by their associated ItemKeyFun records.
+     * This points to tuple whose elements is array of pointers to the
+     * tuple item domains as represented by their associated
+     * ItemKeyFun records.
      */
-    ItemKeyFun **columns;
+    Tuple *columns;
 } TupleSchema;
 
 /**
@@ -42,14 +38,7 @@ typedef struct {
  *
  * \related TupleSchema
  */
-extern tuple *tuple_create(int arity,...);
-
-/**
- * Create a tuples with given values.
- *
- * \related TupleSchema
- */
-extern TupleSchema *TupleSchema_create(int arity,tuple *columns);
+extern TupleSchema *TupleSchema_create(int arity,Tuple *columns);
 
 /**
  * Copy the given TupleSchema into a new TupleSchema with some columns
@@ -61,11 +50,11 @@ extern TupleSchema *TupleSchema_create(int arity,tuple *columns);
 extern TupleSchema *TupleSchema_mask(TupleSchema *schema,...);
 
 /**
- * \brief Return 1/0 to indicate whether the query matches the item.
+ * \brief Return 1/0 to indicate whether the Query matches the item.
  *
  * \related TupleSchema
  */
-extern int TupleSchema_match(TupleSchema *def,tuple *query,tuple *item);
+extern int TupleSchema_match(TupleSchema *def,Tuple *query,Tuple *item);
 
 /**
  * \brief Generic macro to determine the number of expressions in a
@@ -83,7 +72,7 @@ extern int TupleSchema_match(TupleSchema *def,tuple *query,tuple *item);
  *
  * \related TupleSchema
  */
-#define TUPLE(...) tuple_create( NUMARGS(__VA_ARGS__), __VA_ARGS__ )
+#define TUPLE(...) Tuple_create( NUMARGS(__VA_ARGS__), __VA_ARGS__ )
 
 /**
  * \brief Create a \ref TupleSchema with the given column "types".