![]() |
libFirm
|
(Hash)sets containing pointers. More...
Data Structures | |
| struct | pset_entry |
| The entry of a pset, representing an element pointer in the set and its meta-information. More... | |
Macros | |
| #define | pset_insert_ptr(set, key) |
| Inserts into pointer set with default hash function. | |
| #define | pset_hinsert_ptr(set, key) |
| Inserts into pointer set with default hash function and return entry. | |
| #define | pset_remove_ptr(set, key) |
| Removes pointer from pointer set with default hash function. | |
| #define | pset_find_ptr(set, key) |
| Finds pointer in pointer set with default hash function. | |
| #define | pset_new_ptr(slots) |
| Creates new pointer set with default compare function. | |
| #define | pset_new_ptr_default() |
| Creates new pointer set with default compare function and default size. | |
| #define | pset_first(type, pset) |
| Returns the first element of a pset. | |
| #define | pset_next(type, pset) |
| Returns the next element of a pset. | |
| #define | foreach_pset(pset, type, entry) |
| Iterates over a pset. | |
Typedefs | |
| typedef struct pset | pset |
| The abstract type of a pset (Set of pointers). | |
| typedef int(* | pset_cmp_fun) (void const *elt, void const *key) |
| The type of a set compare function. | |
Functions | |
| int | pset_default_ptr_cmp (void const *x, void const *y) |
| The default comparison function for pointers. | |
| pset * | new_pset (pset_cmp_fun func, size_t slots) |
| Creates a new pset. | |
| void | del_pset (pset *pset) |
| Deletes a pset. | |
| size_t | pset_count (pset const *pset) |
| Returns the number of elements in a pset. | |
| void * | pset_find (pset *pset, void const *key, unsigned hash) |
| Searches an element pointer in a pset. | |
| void * | pset_insert (pset *pset, void const *key, unsigned hash) |
| Inserts an element pointer into a pset. | |
| pset_entry * | pset_hinsert (pset *pset, void const *key, unsigned hash) |
| Inserts an element pointer into a pset and returns its pset_entry. | |
| void * | pset_remove (pset *pset, void const *key, unsigned hash) |
| Removes an element from a pset. | |
| void * | pset_first (pset *pset) |
| Returns the first element of a pset. | |
| void * | pset_next (pset *pset) |
| Returns the next element of a pset. | |
| void | pset_break (pset *pset) |
| Breaks the iteration of a set. | |
| void | pset_insert_pset_ptr (pset *target, pset *src) |
| Inserts all elements of the pointer set src into the set target (union). | |
(Hash)sets containing pointers.
| struct pset_entry |
| #define foreach_pset | ( | pset, | |
| type, | |||
| entry ) |
Iterates over a pset.
| pset | the pset |
| type | type of iterator variable |
| entry | the iterator |
| #define pset_find_ptr | ( | set, | |
| key ) |
Finds pointer in pointer set with default hash function.
| #define pset_first | ( | type, | |
| pset ) |
Returns the first element of a pset.
This is a wrapper for pset_first(set); It allows to express the intended type of the set elements (instead of weakly typed void*).
| type | destination type of the pointers in the set |
| pset | the pset to iterate |
| #define pset_hinsert_ptr | ( | set, | |
| key ) |
Inserts into pointer set with default hash function and return entry.
| #define pset_insert_ptr | ( | set, | |
| key ) |
Inserts into pointer set with default hash function.
| #define pset_new_ptr | ( | slots | ) |
Creates new pointer set with default compare function.
| #define pset_new_ptr_default | ( | ) |
Creates new pointer set with default compare function and default size.
| #define pset_next | ( | type, | |
| pset ) |
Returns the next element of a pset.
This is a wrapper for pset_next(set); It allows to express the intended type of the set elements (instead of weakly typed void*).
| type | destination type of the pointers in the set |
| pset | the pset to iterate |
| #define pset_remove_ptr | ( | set, | |
| key ) |
Removes pointer from pointer set with default hash function.
| typedef int(* pset_cmp_fun) (void const *elt, void const *key) |
| void del_pset | ( | pset * | pset | ) |
Deletes a pset.
| pset | the pset |
| pset * new_pset | ( | pset_cmp_fun | func, |
| size_t | slots ) |
Creates a new pset.
| func | The compare function of this pset. |
| slots | Initial number of collision chains. I.e., #slots different keys can be hashed without collisions. |
| void pset_break | ( | pset * | pset | ) |
Breaks the iteration of a set.
Must be called before the next pset_first() call if the iteration was NOT finished.
| pset | the pset |
| size_t pset_count | ( | pset const * | pset | ) |
Returns the number of elements in a pset.
| pset | the pset |
| int pset_default_ptr_cmp | ( | void const * | x, |
| void const * | y ) |
The default comparison function for pointers.
| x | A pointer. |
| y | A pointer. |
x and y are equal. Some value != 0 otherwise. | void * pset_find | ( | pset * | pset, |
| void const * | key, | ||
| unsigned | hash ) |
Searches an element pointer in a pset.
| pset | the pset to search in |
| key | the element to search |
| hash | the hash value of key |
| void * pset_first | ( | pset * | pset | ) |
Returns the first element of a pset.
| pset | the pset to iterate |
| pset_entry * pset_hinsert | ( | pset * | pset, |
| void const * | key, | ||
| unsigned | hash ) |
Inserts an element pointer into a pset and returns its pset_entry.
| pset | the pset to insert in |
| key | a pointer to the element to be inserted |
| hash | the hash-value of the element |
| void * pset_insert | ( | pset * | pset, |
| void const * | key, | ||
| unsigned | hash ) |
Inserts an element pointer into a pset.
| pset | the pset to insert in |
| key | a pointer to the element to be inserted |
| hash | the hash-value of the element |
Inserts all elements of the pointer set src into the set target (union).
| target | the target set, will contain the union |
| src | a set, will not be changed |
| void * pset_next | ( | pset * | pset | ) |
Returns the next element of a pset.
| pset | the pset to iterate |
| void * pset_remove | ( | pset * | pset, |
| void const * | key, | ||
| unsigned | hash ) |
Removes an element from a pset.
| pset | the pset to delete in |
| key | a pointer to the element to be deleted |
| hash | the hash-value of the element |