| Holyrel Library Reference Manual |
|---|
TupleTuple — Tuple. |
#include <libhrel/tuple.h> typedef HTuple; HTupleElem; HTuple* h_tuple_new (void); HTuple* h_tuple_newv (gboolean typed, ...); HTuple* h_tuple_new_v (gboolean typed, va_list args); HTuple* h_tuple_n_new_v (gboolean typed, guint size, va_list args); void h_tuple_free (HTuple *tuple); HTuple* h_tuple_clone (HTuple *tuple); HTuple* h_tuple_clone_elems_l (HTuple *tuple, GSList *list); HTupleElem* h_tuple_get (HTuple *tuple, const gchar *name); gpointer h_tuple_get_value (HTuple *tuple, const gchar *name); 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); gchar* h_tuple_printable_str (HTuple *tuple); gboolean h_tuple_equal (HTuple *tuple1, HTuple *tuple2); gboolean h_tuple_equal_elem (HTuple *tuple1, HTuple *tuple2, const gchar *name); gboolean h_tuple_equal_elems (HTuple *tuple1, HTuple *tuple2, ...); gboolean h_tuple_equal_elems_l (HTuple *tuple1, HTuple *tuple2, GSList *list); 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_l (HTuple *tuple1, HTuple *tuple2, GSList *list); guint h_tuple_hash (HTuple *tuple); guint h_tuple_hash_elems (HTuple *tuple, ...); guint h_tuple_hash_elems_l (HTuple *tuple, GSList *list);
typedef struct {
GType type;
gpointer value;
} HTupleElem;
Stores type and value of a tuple (HTuple) component.
HTuple* h_tuple_new (void);
Creates a new empty tuple.
| Returns : | a newly created empty HTuple, or NULL.
|
HTuple* h_tuple_newv (gboolean typed, ...);
Constructs a tuple from a list of components.
typed : |
set to FALSE to create a typeless tuple |
... : |
name, type (omitted if typeless), value of first component,
followed by the second, and so on, then NULL
|
| Returns : | newly constructed HTuple, or NULL
|
HTuple* h_tuple_new_v (gboolean typed, va_list args);
Constructs a tuple from an argument list.
typed : |
set to FALSE to create a typeless tuple |
args : |
argument list |
| Returns : | a newly constructed HTuple, or NULL
|
HTuple* h_tuple_n_new_v (gboolean typed, guint size, va_list args);
Constructs an n-tuple from an argument list.
typed : |
set to FALSE to create a typeless tuple |
size : |
size |
args : |
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
|
HTuple* h_tuple_clone_elems_l (HTuple *tuple, GSList *list);
Constructs a subset of tuple, with attributes listed in list.
tuple : |
a HTuple |
list : |
list of attribute names |
| Returns : | subset of tuple.
|
HTupleElem* h_tuple_get (HTuple *tuple, const gchar *name);
Returns the type and value of an component in tuple, or NULL if
component doesn't exist.
tuple : |
a HTuple |
name : |
name of component |
| Returns : | a HTupleElem containing the type and value. |
gpointer h_tuple_get_value (HTuple *tuple, const gchar *name);
Returns the value of an component in tuple, or NULL if component
doesn't exist.
tuple : |
a HTuple |
name : |
name of component |
| Returns : | a copy of the component value |
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 component |
type : |
type of component |
value : |
value of type
|
void h_tuple_print (HTuple *tuple);
Prints the content of tuple to stdout.
tuple : |
a HTuple |
gchar* h_tuple_printable_str (HTuple *tuple);
Gets a printable string of tuple.
tuple : |
a HTuple |
| Returns : | Printable string |
gboolean h_tuple_equal (HTuple *tuple1, HTuple *tuple2);
Compares tuple1 and tuple2 for equality.
gboolean h_tuple_equal_elem (HTuple *tuple1, HTuple *tuple2, const gchar *name);
Compares a common component in tuple1 and tuple2 for equality.
gboolean h_tuple_equal_elems (HTuple *tuple1, HTuple *tuple2, ...);
Compares common components in tuple1 and tuple2 for equality. If
no component names are provided, all components are compared
(equivalent to h_tuple_equal()).
gboolean h_tuple_equal_elems_l (HTuple *tuple1, HTuple *tuple2, GSList *list);
A variation of h_tuple_equal_elems() with the component name list is
stored as a GSList.
gint h_tuple_compare_elem (HTuple *tuple1, HTuple *tuple2, const gchar *name);
Compares the values of a common component in tuple1 and tuple2.
gint h_tuple_compare_elems (HTuple *tuple1, HTuple *tuple2, ...);
Compares the values of each common component in tuple1 and tuple2
in the order listed.
gint h_tuple_compare_elems_l (HTuple *tuple1, HTuple *tuple2, GSList *list);
A variation of h_tuple_compare_elems(), where the component name
list is stored as a GSList.
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. If no components were
specified, all components are used to generate the hash. The hash
is independent of the order in which component names are listed.
tuple : |
a HTuple |
... : |
a component name, followed by another, and so on, ending with
a NULL
|
| Returns : | hash number |
| << Tuples | Relations >> |