NuSMV/code/nusmv/core/utils/assoc.h File Reference

#include "cudd/util.h"
#include "nusmv/core/node/node.h"
#include "cudd/st.h"

Go to the source code of this file.

Data Structures

struct  AssocAndDestroy

Defines

#define ASSOC_CONTINUE   ST_CONTINUE
#define ASSOC_DELETE   ST_DELETE
 Simple assscoiative list.
#define ASSOC_FOREACH(table, iter, key, value)   st_foreach_item(table, iter, key, value)
 Iterate over all k-v pairs in the assoc.
#define assoc_get_size(table)   st_count(table)
 Retrieve the number of elements in the hash.
#define assoc_iter_free(iter)   st_free_gen(iter)
 Generates a new iterator for the given hash.
#define assoc_iter_init(table)   st_init_gen(table)
 Generates a new iterator for the given hash.
#define assoc_iter_next(iter, key, value)   st_gen(iter, key, value)
 Iterate over all k-v pairs in the assoc.
#define ASSOC_STOP   ST_STOP

Typedefs

typedef st_generator * assoc_iter
typedef enum st_retval assoc_retval
typedef struct
AssocAndDestroy_TAG * 
AssocAndDestroy_ptr
typedef ST_PFSR PF_STCPCPCP

Functions

hash_ptr assoc_deep_copy (hash_ptr hash, ST_PFSR copy_fun)
void assoc_foreach (hash_ptr hash, ST_PFSR fn, char *arg)
 Iterates over the elements of the hash.
node_ptr assoc_get_keys (hash_ptr hash, NodeMgr_ptr nodemgr, boolean ignore_nils)
 Returns the list of inserted keys. If parameter ignore_nils is true, the those keys whose associated values are Nil (typically, removed associations) will not be added to the returned list. Entries in the returned list are presented in an arbitrary order. NOTE: the invoker has to free the list (see free_list) after using it.
void clear_assoc (hash_ptr hash)
void clear_assoc_and_free_entries (hash_ptr, ST_PFSR)
 this is actually a very general function
void clear_assoc_and_free_entries_arg (hash_ptr hash, ST_PFSR fn, char *arg)
 this is actually a very general function
hash_ptr copy_assoc (hash_ptr hash)
node_ptr find_assoc (hash_ptr, node_ptr)
void free_assoc (hash_ptr hash)
 Frees any internal storage associated with the hash table. It's user responsibility to free any storage associated with the pointers in the table.
void insert_assoc (hash_ptr, node_ptr, node_ptr)
hash_ptr new_assoc (void)
hash_ptr new_assoc_string_key (void)
hash_ptr new_assoc_with_params (ST_PFICPCP compare_fun, ST_PFICPI hash_fun)
hash_ptr new_assoc_with_size (int initial_size)
node_ptr remove_assoc (hash_ptr hash, node_ptr key)
 Removes a key from the table. Returns the data associated with the given key, and if the key has not been in the table then Nil is returned.

Define Documentation

#define ASSOC_CONTINUE   ST_CONTINUE
Todo:
Missing synopsis
Todo:
Missing description
#define ASSOC_DELETE   ST_DELETE

Simple assscoiative list.

Author:
Marco Roveri Provides the user with a data structure that implemnts an associative list. If there is already an entry with the same ky in the table, than the value associated is replaced with the new one.
Todo:
Missing synopsis
Todo:
Missing description
#define ASSOC_FOREACH ( table,
iter,
key,
value   )     st_foreach_item(table, iter, key, value)

Iterate over all k-v pairs in the assoc.

Iterate over all k-v pairs in the assoc.

IMPORTANT NOTE: If the loop is interrupted (e.g. by a "break" call, the iterator must be freed manually

Expected types: st_table* table st_generator* iter char** key char** value

Todo:
Missing synopsis
Todo:
Missing description
#define assoc_get_size ( table   )     st_count(table)

Retrieve the number of elements in the hash.

Retrieve the number of elements in the hash

Todo:
Missing synopsis
Todo:
Missing description
#define assoc_iter_free ( iter   )     st_free_gen(iter)

Generates a new iterator for the given hash.

Generates a new iterator for the given hash

Todo:
Missing synopsis
Todo:
Missing description
#define assoc_iter_init ( table   )     st_init_gen(table)

Generates a new iterator for the given hash.

Generates a new iterator for the given hash

Todo:
Missing synopsis
Todo:
Missing description
#define assoc_iter_next ( iter,
key,
value   )     st_gen(iter, key, value)

Iterate over all k-v pairs in the assoc.

Returns the next k-v pair in the iterator. If there are no more items, returns 0

Todo:
Missing synopsis
Todo:
Missing description
#define ASSOC_STOP   ST_STOP
Todo:
Missing synopsis
Todo:
Missing description

Typedef Documentation

typedef st_generator* assoc_iter
Todo:
Missing synopsis
Todo:
Missing description
typedef enum st_retval assoc_retval
typedef struct AssocAndDestroy_TAG* AssocAndDestroy_ptr
typedef ST_PFSR PF_STCPCPCP
Todo:
Missing synopsis
Todo:
Missing description

Function Documentation

hash_ptr assoc_deep_copy ( hash_ptr  hash,
ST_PFSR  copy_fun 
)
void assoc_foreach ( hash_ptr  hash,
ST_PFSR  fn,
char *  arg 
)

Iterates over the elements of the hash.

For each (key, value) record in `hash', assoc_foreach call func with the arguments

   (*func)(key, value, arg)
   

If func returns ASSOC_CONTINUE, st_foreach continues processing entries. If func returns ASSOC_STOP, st_foreach stops processing and returns immediately. If func returns ASSOC_DELETE, then the entry is deleted from the symbol table and st_foreach continues. In the case of ASSOC_DELETE, it is func's responsibility to free the key and value, if necessary.

None

node_ptr assoc_get_keys ( hash_ptr  hash,
NodeMgr_ptr  nodemgr,
boolean  ignore_nils 
)

Returns the list of inserted keys. If parameter ignore_nils is true, the those keys whose associated values are Nil (typically, removed associations) will not be added to the returned list. Entries in the returned list are presented in an arbitrary order. NOTE: the invoker has to free the list (see free_list) after using it.

WARNING: Calling this function is not free: The whole hash is traversed and the list of nodes is created (and has to be freed). Use ASSOC_FOREACH or assoc_foreach if possible

void clear_assoc ( hash_ptr  hash  ) 
void clear_assoc_and_free_entries ( hash_ptr  ,
ST_PFSR   
)

this is actually a very general function

void clear_assoc_and_free_entries_arg ( hash_ptr  hash,
ST_PFSR  fn,
char *  arg 
)

this is actually a very general function

hash_ptr copy_assoc ( hash_ptr  hash  ) 
node_ptr find_assoc ( hash_ptr  ,
node_ptr   
)
void free_assoc ( hash_ptr  hash  ) 

Frees any internal storage associated with the hash table. It's user responsibility to free any storage associated with the pointers in the table.

void insert_assoc ( hash_ptr  ,
node_ptr  ,
node_ptr   
)
Todo:
Missing synopsis
Todo:
Missing description
hash_ptr new_assoc ( void   ) 
hash_ptr new_assoc_string_key ( void   ) 
hash_ptr new_assoc_with_params ( ST_PFICPCP  compare_fun,
ST_PFICPI  hash_fun 
)
hash_ptr new_assoc_with_size ( int  initial_size  ) 
node_ptr remove_assoc ( hash_ptr  hash,
node_ptr  key 
)

Removes a key from the table. Returns the data associated with the given key, and if the key has not been in the table then Nil is returned.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on 14 Oct 2015 for NuSMV Developers Manual by  doxygen 1.6.1