Relation

Relation — Base class of all relations.

Synopsis


#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)
GType       h_relation_get_type             (void);
void        h_relation_set_name             (HRelation *relation,
                                             const gchar *name);
void        h_relation_set_desc             (HRelation *relation,
                                             const gchar *desc);
gchar*      h_relation_get_name             (HRelation *relation);
gchar*      h_relation_get_desc             (HRelation *relation);
void        h_relation_print                (HRelation *relation);
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);
guint       h_relation_get_size             (HRelation *relation);
guint       h_relation_get_n_attrs          (HRelation *relation);

Object Hierarchy


  GObject
   +----HRelation
         +----HRelationBase
         +----HRelationSort
         +----HRelationRestrict

Properties


  "description"          gchararray            : Read / Write
  "name"                 gchararray            : Read / Write

Signal Prototypes


"delete-tuple"
            void        user_function      (HRelation *hrelation,
                                            HTuple *arg1,
                                            gpointer user_data);
"insert-tuple"
            void        user_function      (HRelation *hrelation,
                                            HTuple *arg1,
                                            gpointer user_data);

Description

Details

HRelation

typedef struct _HRelation HRelation;


HAttribute

typedef struct {
  gchar *name;
  GType  type;
} HAttribute;

Holds the complete description of an attribute.

gchar *name; name
GType type; type ID

HAttrFunc ()

void        (*HAttrFunc)                    (HAttribute *attr,
                                             gpointer user_data);

HAttribute function.

attr : an HAttribute
user_data : user data

HTupleFunc ()

void        (*HTupleFunc)                   (HTuple *tuple,
                                             gpointer user_data);

HTuple function.

tuple : a HTuple
user_data : user data

h_relation_ref()

#define h_relation_ref(relation)   g_object_ref (relation)

Increases the reference count of relation.

relation : a HRelation

h_relation_unref()

#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

h_relation_get_type ()

GType       h_relation_get_type             (void);

Returns the Glib type ID of HRelation.

Returns : type ID

h_relation_set_name ()

void        h_relation_set_name             (HRelation *relation,
                                             const gchar *name);

Set the name of relation.

relation : a HRelation
name : name

h_relation_set_desc ()

void        h_relation_set_desc             (HRelation *relation,
                                             const gchar *desc);

Set the description of relation.

relation : a HRelation
desc : description

h_relation_get_name ()

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.

h_relation_get_desc ()

gchar*      h_relation_get_desc             (HRelation *relation);

Returns the description of relation.

relation : a HRelation
Returns : a copy of the description string, or NULL if no description exists

h_relation_print ()

void        h_relation_print                (HRelation *relation);

Prints relation to stdout.

relation : a HRelation

h_relation_for_each_attr ()

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

h_relation_for_each_tuple ()

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

h_relation_get_size ()

guint       h_relation_get_size             (HRelation *relation);

Returns the number of tuples in relation.

relation : a HRelation
Returns : number of tuples

h_relation_get_n_attrs ()

guint       h_relation_get_n_attrs          (HRelation *relation);

Returns the number of attributes in relation.

relation : a HRelation
Returns : number of attributes

Properties

The "description" property

  "description"          gchararray            : Read / Write

Description of relation.

Default value: NULL


The "name" property

  "name"                 gchararray            : Read / Write

Name of relation.

Default value: NULL

Signals

The "delete-tuple" signal

void        user_function                  (HRelation *hrelation,
                                            HTuple *arg1,
                                            gpointer user_data);

Emitted when a tuple is removed from relation.

relation : HRelation which received the signal
arg1 : tuple deleted
user_data : user data set when the signal handler was connected.

The "insert-tuple" signal

void        user_function                  (HRelation *hrelation,
                                            HTuple *arg1,
                                            gpointer user_data);

Emitted when a tuple is inserted into relation.

relation : HRelation which received the signal
arg1 : tuple inserted
user_data : user data set when the signal handler was connected.