Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

hashtree.h

Go to the documentation of this file.
00001 /*
00002  * $Id: hashtree.h,v 1.5 2005/07/01 09:35:35 daichik Exp $
00003  *
00004  * Copyright (c) 2003 Jeroen Asselman.
00005  *
00006  *----------------------------------------------------------------------
00007  *   The contents of this file are subject to the Mozilla Public License
00008  *   Version 1.1 (the "License"); you may not use this file except in
00009  *   compliance with the License. You may obtain a copy of the License at
00010  *   http://www.mozilla.org/MPL/
00011  *
00012  *   Software distributed under the License is distributed on an "AS IS"
00013  *   basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
00014  *   License for the specific language governing rights and limitations
00015  *   under the License.
00016  *
00017  *   The Original Code is hashtree.h, released Sun, 07 Sep 2003.
00018  *
00019  *   The Initial Developer of the Original Code is Jeroen Asselman
00020  *   Portions created by the Initial Developer are Copyright (C) 2003
00021  *   the Initial Developer. All Rights Reserved.
00022  *
00023  *   Contributor(s):
00024  *
00025  *   Alternatively, the contents of this file may be used under the terms
00026  *   of the GNU General Public License Version 2 or later (the  "GPL"), in
00027  *   which case the provisions of GPL are applicable instead of those
00028  *   above.  If you wish to allow use of your version of this file only
00029  *   under the terms of the GPL and not to allow others to use
00030  *   your version of this file under the MPL, indicate your decision by
00031  *   deleting  the provisions above and replace  them with the notice and
00032  *   other provisions required by the GPL.  If you do not delete
00033  *   the provisions above, a recipient may use your version of this file
00034  *   under either the MPL or the GPL License.
00035  *----------------------------------------------------------------------
00036  */
00037 
00048 #ifndef _core_hashtree_h_
00049 #define _core_hashtree_h_
00050 
00051 typedef struct node_s node_t;
00052 struct node_s {
00053     node_t  *left_node;
00054     node_t  *right_node;
00055 
00056     gpointer    hash;
00057 
00058     int level;
00059 };
00060 
00061 typedef struct hashtree_s hashtree;
00062 struct hashtree_s {
00063     node_t  *parent;
00064 
00065     gint depth;
00066 
00067     gpointer    (* hash_func) (gpointer hash1, gpointer hash2);
00068 };
00069 
00070 hashtree    *hashtree_new(gpointer (*hash_func)(gpointer, gpointer));
00071 void         hashtree_append_leaf_node(hashtree *parent, gpointer hash);
00072 void         hashtree_finish(hashtree *parent);
00073 void         hashtree_destroy(hashtree *tree);
00074 
00075 #endif  /* _core_hashtree_h_ */
00076 
00077 /* vi: set ts=4 sw=4 cindent: */

Generated on Sun Feb 12 10:49:56 2006 for Gtk-Gnutella by doxygen 1.3.6