![]() |
![]() |
![]() |
Holyrel Library Reference Manual | ![]() |
---|
TupleTuple — Tuple. |
#include <libhrel/tuple.h> typedef HTuple; HTupleElem; GType h_tuple_get_type (void); HTuple* h_tuple_new (void); HTuple* h_tuple_new_v (guint size, va_list list); void h_tuple_free (HTuple *tuple); HTuple* h_tuple_clone (HTuple *tuple); guint h_tuple_get_size (HTuple *tuple); void h_tuple_insert (HTuple *tuple, const gchar *name, GType type, gpointer value); void h_tuple_print (HTuple *tuple); HTupleElem* h_tuple_get (HTuple *tuple, const gchar *name); gpointer h_tuple_get_value (HTuple *tuple, const gchar *name); gboolean h_tuple_equal (HTuple *tuple1, HTuple *tuple2); gint h_tuple_compare_elem (HTuple *tuple1, HTuple *tuple2, const gchar *name); gint h_tuple_compare_elems (HTuple *tuple1, HTuple *tuple2, ...); gint h_tuple_compare_elems_v (HTuple *tuple1, HTuple *tuple2, va_list elem_names); guint h_tuple_hash (HTuple *tuple); guint h_tuple_hash_elems (HTuple *tuple, ...);
typedef struct { GType type; gpointer value; } HTupleElem;
Stores type and value of a tuple (HTuple) component.
GType h_tuple_get_type (void);
Returns the Glib type ID for HTuple.
Returns : | type ID for HTuple |
HTuple* h_tuple_new (void);
Creates a new empty tuple.
Returns : | a newly created empty HTuple, or NULL .
|
HTuple* h_tuple_new_v (guint size, va_list list);
Constructs a tuple from an argument list.
size : |
degree |
list : |
argument list |
Returns : | a newly constructed HTuple, or NULL .
|
HTuple* h_tuple_clone (HTuple *tuple);
Returns a copy of tuple
.
tuple : |
a HTuple |
Returns : | copy of tuple
|
guint h_tuple_get_size (HTuple *tuple);
Returns the degree ('size') of tuple
.
tuple : |
a HTuple |
Returns : | degree ('size') of tuple
|
void h_tuple_insert (HTuple *tuple, const gchar *name, GType type, gpointer value);
Adds a new atribute named name
, of type type
and value value
.
tuple : |
a HTuple |
name : |
name of attribute |
type : |
type of attribute |
value : |
value of type
|
void h_tuple_print (HTuple *tuple);
Prints the content of tuple
to stdout.
tuple : |
a HTuple |
HTupleElem* h_tuple_get (HTuple *tuple, const gchar *name);
Returns the type and value of an attribute in tuple
, or NULL
if
attribute doesn't exist.
tuple : |
a HTuple |
name : |
name of attribute |
Returns : | a HTupleElem containing the type and value. |
gpointer h_tuple_get_value (HTuple *tuple, const gchar *name);
Returns the value of an attribute in tuple
, or NULL
if attribute
doesn't exist.
tuple : |
a HTuple |
name : |
name of attribute |
Returns : | a copy of the attribute value |
gboolean h_tuple_equal (HTuple *tuple1, HTuple *tuple2);
Compares two tuple1
and tuple2
for equality. (TODO: Need elaboration).
gint h_tuple_compare_elem (HTuple *tuple1, HTuple *tuple2, const gchar *name);
Compares the values of a common attribute in tuple1
and tuple2
.
gint h_tuple_compare_elems (HTuple *tuple1, HTuple *tuple2, ...);
Compares the values of each common attribute in tuple1
and tuple2
in
the order listed. (TODO: needs elaboration)
gint h_tuple_compare_elems_v (HTuple *tuple1, HTuple *tuple2, va_list elem_names);
Compares the values of a common attribute in tuple1
and tuple2
.
tuple1 : |
left HTuple operand |
tuple2 : |
right HTuple operand |
elem_names : |
argument list (see h_tuple_compare_elems) |
Returns : | -1 if tuple1 is greater, 1 if tuple2 is greater, 0 if equal
|
guint h_tuple_hash (HTuple *tuple);
Returns the hash of tuple
.
tuple : |
a HTuple |
Returns : | hash number |
guint h_tuple_hash_elems (HTuple *tuple, ...);
Returns the hash of a subset of tuple
. Note that the hash is
independent of the order in which attribute names are
listed. (TODO: elaborate).
tuple : |
a HTuple |
... : |
first attribute name, followed by the second, and so on, ending with a NULL .
|
Returns : | hash number |
<< Tuples | Relations >> |