00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00041 #ifndef __NUSMV_CORE_UTILS_ASSOC_H__
00042 #define __NUSMV_CORE_UTILS_ASSOC_H__
00043
00044 #if HAVE_CONFIG_H
00045 # include "nusmv-config.h"
00046 #endif
00047
00048 #include "cudd/util.h"
00049 #include "nusmv/core/node/node.h"
00050 #include "cudd/st.h"
00051
00052
00053
00054
00055
00061 #define ASSOC_DELETE ST_DELETE
00062
00068 #define ASSOC_CONTINUE ST_CONTINUE
00069
00075 #define ASSOC_STOP ST_STOP
00076
00099 #define ASSOC_FOREACH(table, iter, key, value) \
00100 st_foreach_item(table, iter, key, value)
00101
00114 #define assoc_iter_init(table) \
00115 st_init_gen(table)
00116
00130 #define assoc_iter_next(iter, key, value) \
00131 st_gen(iter, key, value)
00132
00145 #define assoc_iter_free(iter) \
00146 st_free_gen(iter)
00147
00160 #define assoc_get_size(table) \
00161 st_count(table)
00162
00163
00164
00165
00166
00173 typedef struct st_table* hash_ptr;
00174 typedef enum st_retval assoc_retval;
00175
00181 typedef st_generator* assoc_iter;
00182
00188 typedef ST_PFSR PF_STCPCPCP;
00189
00190 typedef struct AssocAndDestroy_TAG
00191 {
00192 hash_ptr assoc;
00193 PF_STCPCPCP destroy_func;
00194 } AssocAndDestroy;
00195
00202 typedef struct AssocAndDestroy_TAG* AssocAndDestroy_ptr;
00203
00204
00205
00206
00207
00208
00214 hash_ptr new_assoc(void);
00215
00221 hash_ptr new_assoc_with_size(int initial_size);
00222
00228 hash_ptr new_assoc_with_params(ST_PFICPCP compare_fun,
00229 ST_PFICPI hash_fun);
00230
00236 hash_ptr new_assoc_string_key(void);
00237
00245 void free_assoc(hash_ptr hash);
00246
00252 hash_ptr copy_assoc(hash_ptr hash);
00253 hash_ptr assoc_deep_copy(hash_ptr hash, ST_PFSR copy_fun);
00254
00260 void clear_assoc(hash_ptr hash);
00261
00267 void clear_assoc_and_free_entries(hash_ptr, ST_PFSR);
00268
00274 void
00275 clear_assoc_and_free_entries_arg(hash_ptr hash, ST_PFSR fn, char* arg);
00276
00277
00278
00279
00285 node_ptr find_assoc(hash_ptr, node_ptr);
00286
00292 void insert_assoc(hash_ptr, node_ptr, node_ptr);
00293
00301 node_ptr remove_assoc(hash_ptr hash, node_ptr key);
00302
00317 node_ptr assoc_get_keys(hash_ptr hash,
00318 NodeMgr_ptr nodemgr,
00319 boolean ignore_nils);
00320
00321
00322
00323
00341 void assoc_foreach(hash_ptr hash, ST_PFSR fn, char *arg);
00342
00343 #endif