| Holyrel Library Reference Manual |
|---|
RelationRelation — Relations. |
#include <libhrel/relation.h>
HRelation;
HAttribute;
void (*HAttrFunc) (HAttribute *attr,
gpointer user_data);
void (*HTupleFunc) (HTuple *tuple,
gpointer user_data);
#define h_relation_ref (relation)
#define h_relation_unref (relation)
#define H_RELATION_FLOATING (relation)
void h_relation_sink (HRelation *relation);
HRelation* h_relation_sink_or_ref (HRelation *relation);
void h_relation_set_name (HRelation *relation,
const gchar *name);
void h_relation_set_description (HRelation *relation,
const gchar *desc);
gchar* h_relation_get_name (HRelation *relation);
gchar* h_relation_get_description (HRelation *relation);
guint h_relation_get_degree (HRelation *relation);
guint h_relation_get_cardinality (HRelation *relation);
#define h_relation_get_n_attrs (relation)
#define h_relation_get_n_tuples (relation)
HAttribute* h_relation_get_attr (HRelation *relation,
const gchar *name);
gboolean h_relation_has_same_attrs (HRelation *relation1,
HRelation *relation2);
gboolean h_relation_has_tuple (HRelation *relation,
HTuple *tuple);
void h_relation_for_each_attr (HRelation *relation,
HAttrFunc func,
gpointer user_data);
void h_relation_for_each_tuple (HRelation *relation,
HTupleFunc func,
gpointer user_data);
void h_relation_print (HRelation *relation);
gchar* h_relation_printable_str (HRelation *relation);
"delete-tuple" void user_function (HRelation *hrelation, HTuple *arg1, gpointer user_data); "insert-tuple" void user_function (HRelation *hrelation, HTuple *arg1, gpointer user_data);
typedef struct {
gchar *name;
GType type;
} HAttribute;
Holds the complete description of an attribute.
void (*HAttrFunc) (HAttribute *attr, gpointer user_data);
HAttribute function.
attr : |
an HAttribute |
user_data : |
user data |
void (*HTupleFunc) (HTuple *tuple, gpointer user_data);
HTuple function.
tuple : |
a HTuple |
user_data : |
user data |
#define h_relation_ref(relation) g_object_ref (relation)
Increases the reference count of relation.
relation : |
a HRelation |
#define h_relation_unref(relation) g_object_unref (relation)
Decreases the reference count of relation. relation will be
destroyed when its reference count goes to 0.
relation : |
a HRelation |
#define H_RELATION_FLOATING(relation) (H_RELATION (relation)->floating)
Checks whether relation is unowned i.e. floating.
relation : |
a HRelation |
void h_relation_sink (HRelation *relation);
Removes the floating reference from relation if it exists,
otherwise does nothing.
relation : |
a HRelation |
HRelation* h_relation_sink_or_ref (HRelation *relation);
Removes the floating reference from relation if it exists,
otherwise increase its reference count.
relation : |
a HRelation |
| Returns : | relation
|
void h_relation_set_name (HRelation *relation, const gchar *name);
Set the name of relation.
relation : |
a HRelation |
name : |
name |
void h_relation_set_description (HRelation *relation, const gchar *desc);
Set the description of relation.
relation : |
a HRelation |
desc : |
description |
gchar* h_relation_get_name (HRelation *relation);
Returns the name of relation.
relation : |
a HRelation |
| Returns : | a copy of the name string, or NULL if no name is
set.
|
gchar* h_relation_get_description (HRelation *relation);
Returns the description of relation.
relation : |
a HRelation |
| Returns : | a copy of the description string, or NULL if no
description exists
|
guint h_relation_get_degree (HRelation *relation);
Returns the degree of relation.
relation : |
a HRelation |
| Returns : | degree |
guint h_relation_get_cardinality (HRelation *relation);
Returns the cardinality of relation.
relation : |
a HRelation |
| Returns : | cardinality |
#define h_relation_get_n_attrs(relation) h_relation_get_degree (relation)
Returns the number of attributes in relation. This is an
alternative name for h_relation_get_degree().
relation : |
a HRelation |
| Returns : | number of attributes |
#define h_relation_get_n_tuples(relation) h_relation_get_cardinality (relation)
Returns the number of tuples in relation. This is an alternative
name for h_relation_get_cardinality().
relation : |
a HRelation |
HAttribute* h_relation_get_attr (HRelation *relation, const gchar *name);
Returns an attribute of relation.
relation : |
a HRelation |
name : |
name of attribute |
| Returns : | attribute |
gboolean h_relation_has_same_attrs (HRelation *relation1, HRelation *relation2);
Checks whether two relations have the same set of attributes.
gboolean h_relation_has_tuple (HRelation *relation, HTuple *tuple);
Checks whether a relation contains a tuple.
void h_relation_for_each_attr (HRelation *relation, HAttrFunc func, gpointer user_data);
Performs a function over each attribute in relation.
relation : |
a HRelation |
func : |
function called for each attribute in relation
|
user_data : |
custom data to pass to func
|
void h_relation_for_each_tuple (HRelation *relation, HTupleFunc func, gpointer user_data);
Performs a function over each tuple in relation.
relation : |
a HRelation |
func : |
function called for each tuple in relation
|
user_data : |
custom data to pass to func
|
void h_relation_print (HRelation *relation);
Prints relation to stdout.
relation : |
a HRelation |
description" property"description" gchararray : Read / Write
Description of relation.
Default value: NULL
| << Relations | Base Relation >> |