libFirm 1.20
|
hashset containing pointers More...
Go to the source code of this file.
Defines | |
#define | foreach_pset_new(pset_new, type, ptr, iter) |
Convenience macro for iterating over a pset_new. | |
Typedefs | |
typedef struct pset_new_t | pset_new_t |
a pointer (hash)set | |
typedef struct pset_new_iterator_t | pset_new_iterator_t |
iterator over a pointer set. | |
Functions | |
void | pset_new_init (pset_new_t *pset_new) |
Initializes a pset_new. | |
void | pset_new_init_size (pset_new_t *pset_new, size_t expected_elements) |
Initializes a pset_new. | |
void | pset_new_destroy (pset_new_t *pset_new) |
Destroys a pset_new and frees the memory allocated for hashtable. | |
int | pset_new_insert (pset_new_t *pset_new, void *ptr) |
Inserts an element into a pset_new. | |
void | pset_new_remove (pset_new_t *pset_new, const void *ptr) |
Removes an element from a pset_new. | |
int | pset_new_contains (const pset_new_t *pset_new, const void *ptr) |
Tests whether a pset_new contains a pointer. | |
size_t | pset_new_size (const pset_new_t *pset_new) |
Returns the number of pointers contained in the pset_new. | |
void | pset_new_iterator_init (pset_new_iterator_t *iterator, const pset_new_t *pset_new) |
Initializes a pset_new iterator. | |
void * | pset_new_iterator_next (pset_new_iterator_t *iterator) |
Advances the iterator and returns the current element or NULL if all elements in the pset_new have been processed. | |
void | pset_new_remove_iterator (pset_new_t *pset_new, const pset_new_iterator_t *iterator) |
Removes the element that the iterator currently points to from the hashset. |
hashset containing pointers
Definition in file pset_new.h.
#define foreach_pset_new | ( | pset_new, | |
type, | |||
ptr, | |||
iter | |||
) |
for(pset_new_iterator_init(&iter, pset_new), \ ptr = (type) pset_new_iterator_next(&iter); \ ptr != NULL; ptr = (type) pset_new_iterator_next(&iter))
Convenience macro for iterating over a pset_new.
Definition at line 145 of file pset_new.h.
typedef struct pset_new_iterator_t pset_new_iterator_t |
typedef struct pset_new_t pset_new_t |
a pointer (hash)set
Definition at line 51 of file pset_new.h.
int pset_new_contains | ( | const pset_new_t * | pset_new, |
const void * | ptr | ||
) |
Tests whether a pset_new contains a pointer.
pset_new | Pointer to the pset_new |
ptr | The pointer to test |
pset_new
contains the ptr
, 0 otherwise void pset_new_destroy | ( | pset_new_t * | pset_new | ) |
Destroys a pset_new and frees the memory allocated for hashtable.
The memory of the pset_new itself is not freed.
pset_new | Pointer to the pset_new |
void pset_new_init | ( | pset_new_t * | pset_new | ) |
Initializes a pset_new.
pset_new | Pointer to allocated space for the pset_new |
void pset_new_init_size | ( | pset_new_t * | pset_new, |
size_t | expected_elements | ||
) |
Initializes a pset_new.
pset_new | Pointer to allocated space for the pset_new |
expected_elements | Number of elements expected in the pset_new (roughly) |
int pset_new_insert | ( | pset_new_t * | pset_new, |
void * | ptr | ||
) |
Inserts an element into a pset_new.
pset_new | Pointer to the pset_new |
ptr | Pointer to insert into the pset_new |
void pset_new_iterator_init | ( | pset_new_iterator_t * | iterator, |
const pset_new_t * | pset_new | ||
) |
Initializes a pset_new iterator.
Sets the iterator before the first element in the pset_new.
iterator | Pointer to already allocated iterator memory |
pset_new | Pointer to the pset_new |
void* pset_new_iterator_next | ( | pset_new_iterator_t * | iterator | ) |
Advances the iterator and returns the current element or NULL if all elements in the pset_new have been processed.
iterator | Pointer to the pset_new iterator. |
void pset_new_remove | ( | pset_new_t * | pset_new, |
const void * | ptr | ||
) |
Removes an element from a pset_new.
Does nothing if the pset_new doesn't contain the element.
pset_new | Pointer to the pset_new |
ptr | Pointer to remove from the pset_new |
void pset_new_remove_iterator | ( | pset_new_t * | pset_new, |
const pset_new_iterator_t * | iterator | ||
) |
Removes the element that the iterator currently points to from the hashset.
pset_new | Pointer to the pset_new |
iterator | Pointer to the iterator |
size_t pset_new_size | ( | const pset_new_t * | pset_new | ) |
Returns the number of pointers contained in the pset_new.
pset_new | Pointer to the pset_new |