libFirm
Loading...
Searching...
No Matches

Pointer->Pointer hashmap More...

Data Structures

struct  pmap_entry
 A key, value pair. More...
 

Macros

#define pmap_get(type, map, key)
 Returns the value of "key".
 
#define foreach_pmap(pmap, curr)
 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

pmappmap_create (void)
 Creates a new empty map.
 
pmappmap_create_ex (size_t slots)
 Creates a new empty map with an initial number of slots.
 
void pmap_destroy (pmap *map)
 Deletes a map.
 
void pmap_insert (pmap *map, void const *key, void *value)
 Inserts a pair (key,value) into the map.
 
int pmap_contains (pmap const *map, void const *key)
 Checks if an entry with key "key" exists.
 
pmap_entrypmap_find (pmap const *map, void const *key)
 Returns the key, value pair of "key".
 
void * pmap_get (pmap const *map, void const *key)
 Returns the value of "key".
 
size_t pmap_count (pmap const *map)
 Return number of elements in the map.
 
pmap_entrypmap_first (pmap *map)
 Returns the first entry of a map if the map is not empty.
 
pmap_entrypmap_next (pmap *map)
 Returns the next entry of a map or NULL if all entries were visited.
 
void pmap_break (pmap *map)
 Breaks an iteration.
 

Detailed Description

Pointer->Pointer hashmap


Data Structure Documentation

◆ pmap_entry

struct pmap_entry

A key, value pair.

Definition at line 32 of file pmap.h.

Data Fields
void const * key The key.
void * value The value.

Macro Definition Documentation

◆ foreach_pmap

#define foreach_pmap ( pmap,
curr )
Value:
for (pmap_entry *curr = pmap_first(pmap); curr; curr = pmap_next(pmap))
A key, value pair.
Definition pmap.h:32
pmap_entry * pmap_first(pmap *map)
Returns the first entry of a map if the map is not empty.
pmap_entry * pmap_next(pmap *map)
Returns the next entry of a map or NULL if all entries were visited.
struct pmap pmap
A map which maps addresses to addresses.
Definition pmap.h:27

Iterate over all elements in the map setting curr to the current element.

Definition at line 85 of file pmap.h.

◆ pmap_get

#define pmap_get ( type,
map,
key )
Value:
((type*)pmap_get(map, key))
#define pmap_get(type, map, key)
Returns the value of "key".
Definition pmap.h:67

Returns the value of "key".

This is a wrapper for pmap_get(map, key); It allows to express the intended type of the set elements (instead of weakly typed void*).

Definition at line 67 of file pmap.h.

Typedef Documentation

◆ pmap

typedef struct pmap pmap

A map which maps addresses to addresses.

Definition at line 27 of file pmap.h.

Function Documentation

◆ pmap_break()

void pmap_break ( pmap * map)

Breaks an iteration.

Must be called, if a iteration ends before pmap_next() returns NULL.

◆ pmap_contains()

int pmap_contains ( pmap const * map,
void const * key )

Checks if an entry with key "key" exists.

◆ pmap_count()

size_t pmap_count ( pmap const * map)

Return number of elements in the map.

◆ pmap_create()

pmap * pmap_create ( void )

Creates a new empty map.

◆ pmap_create_ex()

pmap * pmap_create_ex ( size_t slots)

Creates a new empty map with an initial number of slots.

◆ pmap_destroy()

void pmap_destroy ( pmap * map)

Deletes a map.

◆ pmap_find()

pmap_entry * pmap_find ( pmap const * map,
void const * key )

Returns the key, value pair of "key".

◆ pmap_first()

pmap_entry * pmap_first ( pmap * map)

Returns the first entry of a map if the map is not empty.

◆ pmap_get()

void * pmap_get ( pmap const * map,
void const * key )

Returns the value of "key".

◆ pmap_insert()

void pmap_insert ( pmap * map,
void const * key,
void * value )

Inserts a pair (key,value) into the map.

If an entry with key "key" already exists, its "value" is overwritten.

◆ pmap_next()

pmap_entry * pmap_next ( pmap * map)

Returns the next entry of a map or NULL if all entries were visited.