grel.h

Go to the documentation of this file.
00001 /* GLIB - Library of useful routines for C programming
00002  * Copyright (C) 1995-1997  Peter Mattis, Spencer Kimball and Josh MacDonald
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the
00016  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017  * Boston, MA 02111-1307, USA.
00018  */
00019 
00020 /*
00021  * Modified by the GLib Team and others 1997-2000.  See the AUTHORS
00022  * file for a list of people on the GLib Team.  See the ChangeLog
00023  * files for a list of changes.  These files are distributed with
00024  * GLib at ftp://ftp.gtk.org/pub/gtk/. 
00025  */
00026 
00027 #ifndef __G_REL_H__
00028 #define __G_REL_H__
00029 
00030 #include <g_types.h>
00031 
00032 G_BEGIN_DECLS
00033 
00034 typedef struct _GRelation       GRelation;
00035 typedef struct _GTuples         GTuples;
00036 
00037 struct _GTuples
00038 {
00039   guint len;
00040 };
00041 
00042 /* GRelation
00043  *
00044  * Indexed Relations.  Imagine a really simple table in a
00045  * database.  Relations are not ordered.  This data type is meant for
00046  * maintaining a N-way mapping.
00047  *
00048  * g_relation_new() creates a relation with FIELDS fields
00049  *
00050  * g_relation_destroy() frees all resources
00051  * g_tuples_destroy() frees the result of g_relation_select()
00052  *
00053  * g_relation_index() indexes relation FIELD with the provided
00054  *   equality and hash functions.  this must be done before any
00055  *   calls to insert are made.
00056  *
00057  * g_relation_insert() inserts a new tuple.  you are expected to
00058  *   provide the right number of fields.
00059  *
00060  * g_relation_delete() deletes all relations with KEY in FIELD
00061  * g_relation_select() returns ...
00062  * g_relation_count() counts ...
00063  */
00064 
00065 GRelation* g_relation_new     (gint         fields);
00066 void       g_relation_destroy (GRelation   *relation);
00067 void       g_relation_index   (GRelation   *relation,
00068                                gint         field,
00069                                GHashFunc    hash_func,
00070                                GEqualFunc   key_equal_func);
00071 void       g_relation_insert  (GRelation   *relation,
00072                                ...);
00073 gint       g_relation_delete  (GRelation   *relation,
00074                                gconstpointer  key,
00075                                gint         field);
00076 GTuples*   g_relation_select  (GRelation   *relation,
00077                                gconstpointer  key,
00078                                gint         field);
00079 gint       g_relation_count   (GRelation   *relation,
00080                                gconstpointer  key,
00081                                gint         field);
00082 gboolean   g_relation_exists  (GRelation   *relation,
00083                                ...);
00084 void       g_relation_print   (GRelation   *relation);
00085 
00086 void       g_tuples_destroy   (GTuples     *tuples);
00087 gpointer   g_tuples_index     (GTuples     *tuples,
00088                                gint         index,
00089                                gint         field);
00090 
00091 G_END_DECLS
00092 
00093 #endif /* __G_REL_H__ */
00094 

Generated on Tue Jul 5 14:14:41 2011 for ROOT_528-00b_version by  doxygen 1.5.1