hashtable_xsb.h

00001 /* File:      hashtable_xsb.h  -- a simple generic hash table ADT
00002 ** Author(s): Michael Kifer
00003 ** Contact:   xsb-contact@cs.sunysb.edu
00004 ** 
00005 ** Copyright (C) The Research Foundation of SUNY, 2002
00006 ** 
00007 ** XSB is free software; you can redistribute it and/or modify it under the
00008 ** terms of the GNU Library General Public License as published by the Free
00009 ** Software Foundation; either version 2 of the License, or (at your option)
00010 ** any later version.
00011 ** 
00012 ** XSB is distributed in the hope that it will be useful, but WITHOUT ANY
00013 ** WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00014 ** FOR A PARTICULAR PURPOSE.  See the GNU Library General Public License for
00015 ** more details.
00016 ** 
00017 ** You should have received a copy of the GNU Library General Public License
00018 ** along with XSB; if not, write to the Free Software Foundation,
00019 ** Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00020 **
00021 ** $Id: hashtable_xsb.h,v 1.4 2005/09/16 00:56:41 tswift Exp $
00022 ** 
00023 */
00024 
00025 
00026 /* clients can define their own bucket structures as long as the top of that
00027    structure coinsides with xsbBucket */
00028 typedef struct bucket xsbBucket;
00029 struct bucket {
00030   Cell        name;
00031   xsbBucket  *next;
00032 };
00033 
00034 typedef struct bt_storage_hash_table_struct  xsbHashTable;
00035 struct bt_storage_hash_table_struct {
00036   int           length;
00037   int           bucket_size;  
00038   xsbBool       initted;
00039   byte         *table;
00040 };
00041 
00042 enum  xsbHashSearchOp {hashtable_insert, hashtable_delete, hashtable_find};
00043 
00044 
00045 extern xsbBucket *search_bucket(Cell name, xsbHashTable *tbl,
00046                                 enum xsbHashSearchOp search_op);
00047 
00048 extern void destroy_hash_table(xsbHashTable *table);
00049 
00050 extern void show_table_state(xsbHashTable *table);

Generated on Wed Jul 26 13:30:41 2006 for XSB by  doxygen 1.4.5