libFirm
|
Pointer->Pointer hashmap. More...
Data Structures | |
struct | pmap_entry |
A key, value pair. More... |
Macros | |
#define | pmap_get(type, map, key) ((type*)pmap_get(map, key)) |
Returns the value of "key". | |
#define | foreach_pmap(pmap, curr) for (curr = pmap_first(pmap); curr; curr = pmap_next(pmap)) |
Iterate over all elements in the map setting curr to the current element. |
Typedefs | |
typedef struct pmap | pmap |
A map which maps addresses to addresses. |
Functions | |
pmap * | pmap_create (void) |
Creates a new empty map. | |
pmap * | pmap_create_ex (size_t slots) |
Creates a new empty map with an initial number of slots. | |
void | pmap_destroy (pmap *) |
Deletes a map. | |
void | pmap_insert (pmap *map, const void *key, void *value) |
Inserts a pair (key,value) into the map. | |
int | pmap_contains (pmap *map, const void *key) |
Checks if an entry with key "key" exists. | |
pmap_entry * | pmap_find (pmap *map, const void *key) |
Returns the key, value pair of "key". | |
void * | pmap_get (pmap *map, const void *key) |
Returns the value of "key". | |
size_t | pmap_count (pmap *map) |
Return number of elements in the map. | |
pmap_entry * | pmap_first (pmap *map) |
Returns the first entry of a map if the map is not empty. | |
pmap_entry * | pmap_next (pmap *) |
Returns the next entry of a map or NULL if all entries were visited. | |
void | pmap_break (pmap *map) |
Breaks an iteration. |
Pointer->Pointer hashmap.
#define foreach_pmap | ( | pmap, | |
curr | |||
) | for (curr = pmap_first(pmap); curr; curr = pmap_next(pmap)) |
#define pmap_get | ( | type, | |
map, | |||
key | |||
) | ((type*)pmap_get(map, key)) |
Returns the value of "key".
This is a wrapper for pmap_get(pmap <em>map); It allows to express the intended type of the set elements (instead of weakly typed void).
void pmap_break | ( | pmap * | map | ) |
Breaks an iteration.
Must be called, if a iteration ends before p_map_next() returns NULL.
int pmap_contains | ( | pmap * | map, |
const void * | key | ||
) |
Checks if an entry with key "key" exists.
size_t pmap_count | ( | pmap * | map | ) |
Return number of elements in the map.
pmap* pmap_create | ( | void | ) |
Creates a new empty map.
pmap* pmap_create_ex | ( | size_t | slots | ) |
Creates a new empty map with an initial number of slots.
void pmap_destroy | ( | pmap * | ) |
Deletes a map.
pmap_entry* pmap_find | ( | pmap * | map, |
const void * | key | ||
) |
Returns the key, value pair of "key".
pmap_entry* pmap_first | ( | pmap * | map | ) |
Returns the first entry of a map if the map is not empty.
void* pmap_get | ( | pmap * | map, |
const void * | key | ||
) |
Returns the value of "key".
void pmap_insert | ( | pmap * | map, |
const void * | key, | ||
void * | value | ||
) |
Inserts a pair (key,value) into the map.
If an entry with key "key" already exists, its "value" is overwritten.
pmap_entry* pmap_next | ( | pmap * | ) |
Returns the next entry of a map or NULL if all entries were visited.