cudd  3.0.0
The University of Colorado Decision Diagram Package
st.h
Go to the documentation of this file.
1 
68 #ifndef ST_H_
69 #define ST_H_
70 
71 /*---------------------------------------------------------------------------*/
72 /* Nested includes */
73 /*---------------------------------------------------------------------------*/
74 
75 /*---------------------------------------------------------------------------*/
76 /* Constant declarations */
77 /*---------------------------------------------------------------------------*/
78 
82 #define ST_OUT_OF_MEM -10000
83 
88 #define ST_DEFAULT_MAX_DENSITY 5
89 
94 #define ST_DEFAULT_INIT_TABLE_SIZE 11
95 
100 #define ST_DEFAULT_GROW_FACTOR 2.0
101 
106 #define ST_DEFAULT_REORDER_FLAG 0
107 
108 /*---------------------------------------------------------------------------*/
109 /* Stucture declarations */
110 /*---------------------------------------------------------------------------*/
111 
112 
113 /*---------------------------------------------------------------------------*/
114 /* Type declarations */
115 /*---------------------------------------------------------------------------*/
116 
120 typedef struct st_table st_table;
121 
125 typedef struct st_generator st_generator;
126 
130 enum st_retval {ST_CONTINUE, ST_STOP, ST_DELETE};
131 
135 typedef enum st_retval (*st_foreach_t)(void *, void *, void *);
136 
140 typedef int (*st_compare_t)(void const *, void const *);
141 
145 typedef int (*st_hash_t)(void const *, int);
146 
150 typedef int (*st_compare_arg_t)(void const *, void const *, void const *);
151 
155 typedef int (*st_hash_arg_t)(void const *, int, void const *);
156 
157 /*---------------------------------------------------------------------------*/
158 /* Variable declarations */
159 /*---------------------------------------------------------------------------*/
160 
161 
162 /*---------------------------------------------------------------------------*/
163 /* Macro declarations */
164 /*---------------------------------------------------------------------------*/
165 
177 #define st_is_member(table,key) st_lookup(table,key,(void **) 0)
178 
179 
201 #define st_foreach_item(table, gen, key, value) \
202  for(gen=st_init_gen(table); st_gen(gen,key,value) || (st_free_gen(gen),0);)
203 
204 
228 #define st_foreach_item_int(table, gen, key, value) \
229  for(gen=st_init_gen(table); st_gen_int(gen,key,value) || (st_free_gen(gen),0);)
230 
231 /*---------------------------------------------------------------------------*/
232 /* Function prototypes */
233 /*---------------------------------------------------------------------------*/
234 
235 #ifdef __cplusplus
236 extern "C" {
237 #endif
238 
239 st_table *st_init_table_with_params (st_compare_t, st_hash_t, int, int, double, int);
241 st_table *st_init_table_with_params_and_arg (st_compare_arg_t, st_hash_arg_t, void const *, int, int, double, int);
243 void st_free_table (st_table *);
244 int st_lookup (st_table *, void const *, void **);
245 int st_lookup_int (st_table *, void const *, int *);
246 int st_insert (st_table *, void *, void *);
247 int st_add_direct (st_table *, void *, void *);
248 int st_find_or_add (st_table *, void *, void ***);
249 int st_find (st_table *, void const *, void ***);
250 st_table *st_copy (st_table const *);
251 int st_delete (st_table *, void **, void **);
252 int st_delete_int (st_table *, void **, int *);
253 int st_count(st_table const *);
254 int st_foreach (st_table *, st_foreach_t, void *);
255 int st_strhash (void const *, int);
256 int st_numhash (void const *, int);
257 int st_ptrhash (void const *, int);
258 int st_numcmp (void const *, void const *);
259 int st_ptrcmp (void const *, void const *);
261 int st_gen (st_generator *, void **, void **);
262 int st_gen_int (st_generator *, void **, int *);
263 void st_free_gen (st_generator *);
264 
265 #ifdef __cplusplus
266 } /* end of extern "C" */
267 #endif
268 
269 #endif /* ST_H_ */
int st_find_or_add(st_table *, void *, void ***)
Lookup key in table; if not found, create an entry.
Definition: st.c:636
int st_ptrcmp(void const *, void const *)
Pointer comparison function.
Definition: st.c:988
Symbol table header.
Definition: st.c:101
st_table * st_copy(st_table const *)
Returns a copy of old_table and all its members.
Definition: st.c:715
int st_lookup_int(st_table *, void const *, int *)
Lookup up key in table.
Definition: st.c:495
void st_free_gen(st_generator *)
Reclaims the resources associated with gen.
Definition: st.c:1130
int st_gen(st_generator *, void **, void **)
Returns the next (key, value) pair in the generation sequence.
Definition: st.c:1046
void st_free_table(st_table *)
Free a table.
Definition: st.c:427
int st_gen_int(st_generator *, void **, int *)
Returns the next (key, value) pair in the generation sequence.
Definition: st.c:1090
int st_numcmp(void const *, void const *)
Integral number comparison function.
Definition: st.c:972
int(* st_hash_t)(void const *, int)
Type of hash functions.
Definition: st.h:145
int st_delete_int(st_table *, void **, int *)
Deletes the entry with the key pointed to by keyp.
Definition: st.c:816
int st_delete(st_table *, void **, void **)
Deletes the entry with the key pointed to by keyp.
Definition: st.c:776
Symbol table generator.
Definition: st.c:118
int st_insert(st_table *, void *, void *)
Insert value in table under the key key.
Definition: st.c:528
int(* st_compare_t)(void const *, void const *)
Type of comparison functions.
Definition: st.h:140
st_retval
Type of return values for iterators.
Definition: st.h:130
int st_strhash(void const *, int)
String hash function.
Definition: st.c:916
int st_lookup(st_table *, void const *, void **)
Lookup up key in table.
Definition: st.c:460
int(* st_hash_arg_t)(void const *, int, void const *)
Type of hash functions with extra argument.
Definition: st.h:155
enum st_retval(* st_foreach_t)(void *, void *, void *)
Type for function passed to st_foreach.
Definition: st.h:135
int st_add_direct(st_table *, void *, void *)
Place 'value' in 'table' under the key 'key'.
Definition: st.c:579
st_table * st_init_table_with_params(st_compare_t, st_hash_t, int, int, double, int)
Create a table with given parameters.
Definition: st.c:315
int st_find(st_table *, void const *, void ***)
Lookup key in table.
Definition: st.c:683
st_generator * st_init_gen(st_table const *)
Initializes a generator.
Definition: st.c:1008
st_table * st_init_table_with_arg(st_compare_arg_t, st_hash_arg_t, void const *)
Creates and initializes a table.
Definition: st.c:400
int(* st_compare_arg_t)(void const *, void const *, void const *)
Type of comparison functions with extra argument.
Definition: st.h:150
int st_ptrhash(void const *, int)
Pointer hash function.
Definition: st.c:956
int st_numhash(void const *, int)
Integral number hash function.
Definition: st.c:940
st_table * st_init_table(st_compare_t, st_hash_t)
Creates and initializes a table.
Definition: st.c:283
int st_foreach(st_table *, st_foreach_t, void *)
Iterates over the elements of a table.
Definition: st.c:878
int st_count(st_table const *)
Returns the number of entries in the table table.
Definition: st.c:846
st_table * st_init_table_with_params_and_arg(st_compare_arg_t, st_hash_arg_t, void const *, int, int, double, int)
Creates and initializes a table.
Definition: st.c:366