1 /* =============================================================================
4 * -- Fixed-size hash table
6 * =============================================================================
8 * Copyright (C) Stanford University, 2006. All Rights Reserved.
11 * =============================================================================
13 * For the license of bayes/sort.h and bayes/sort.c, please see the header
16 * ------------------------------------------------------------------------
18 * For the license of kmeans, please see kmeans/LICENSE.kmeans
20 * ------------------------------------------------------------------------
22 * For the license of ssca2, please see ssca2/COPYRIGHT
24 * ------------------------------------------------------------------------
26 * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the
27 * header of the files.
29 * ------------------------------------------------------------------------
31 * For the license of lib/rbtree.h and lib/rbtree.c, please see
32 * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree
34 * ------------------------------------------------------------------------
36 * Unless otherwise noted, the following license applies to STAMP files:
38 * Copyright (c) 2007, Stanford University
39 * All rights reserved.
41 * Redistribution and use in source and binary forms, with or without
42 * modification, are permitted provided that the following conditions are
45 * * Redistributions of source code must retain the above copyright
46 * notice, this list of conditions and the following disclaimer.
48 * * Redistributions in binary form must reproduce the above copyright
49 * notice, this list of conditions and the following disclaimer in
50 * the documentation and/or other materials provided with the
53 * * Neither the name of Stanford University nor the names of its
54 * contributors may be used to endorse or promote products derived
55 * from this software without specific prior written permission.
57 * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY
58 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
59 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
60 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE
61 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
62 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
63 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
64 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
65 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
66 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
67 * THE POSSIBILITY OF SUCH DAMAGE.
69 * =============================================================================
81 typedef struct table {
87 /* =============================================================================
89 * -- Returns NULL on failure
90 * =============================================================================
93 table_alloc (long numBucket, long (*compare)(const void*, const void*));
96 /* =============================================================================
98 * -- Returns TRUE if successful, else FALSE
99 * =============================================================================
102 table_insert (table_t* tablePtr, ulong_t hash, void* dataPtr);
105 /* =============================================================================
107 * -- Returns TRUE if successful, else FALSE
108 * =============================================================================
111 TMtable_insert (TM_ARGDECL table_t* tablePtr, ulong_t hash, void* dataPtr);
114 /* =============================================================================
116 * -- Returns TRUE if successful, else FALSE
117 * =============================================================================
120 table_remove (table_t* tablePtr, ulong_t hash, void* dataPtr);
123 /* =============================================================================
125 * =============================================================================
128 table_free (table_t* tablePtr);
131 #define TMTABLE_INSERT(t, h, d) TMtable_insert(TM_ARG t, h, d)
137 /* =============================================================================
141 * =============================================================================