Modules | |
| The Map Interface | |
Typedefs | |
| typedef Cmaid_Container | Cmaid_Map |
| Type definition of the Map Class. | |
Functions | |
| CMAID_INLINE void * | cmaid_map_set (Cmaid_Map *m, void *key, void *data) |
Associates the given key with the give value. | |
| CMAID_INLINE void | cmaid_map_remove (Cmaid_Map *m, const void *key) |
| Removes the key-value pair from the map. | |
| CMAID_INLINE void * | cmaid_map_get (Cmaid_Map *m, const void *key) |
| CMAID_INLINE void | cmaid_map_value_iter_attach (Cmaid_Map *m, Cmaid_Iter *iter) |
| Attaches an iterator to iterate over the values. | |
The map class provides an interface to associate a key object with a value object. This is also known as associative array. The key needs to be unique, else you would get collisions, but the values maybe the same for two different keys.
The iterators attached with cmaid_container_iter_attach() function, iterate over the key values. To iterate over the values use the map function cmaid_map_value_iter_attach().
| CMAID_INLINE void* cmaid_map_get | ( | Cmaid_Map * | m, | |
| const void * | key | |||
| ) |
| m | The map to retrieve the value associated with the given key | |
| key | The key associated with the desired value |
key key. If there is no value associated with it NULL will be returned.
| CMAID_INLINE void cmaid_map_remove | ( | Cmaid_Map * | m, | |
| const void * | key | |||
| ) |
Removes the key-value pair from the map.
| m | The map to remove the key-value pair | |
| key | The key to remove |
| CMAID_INLINE void* cmaid_map_set | ( | Cmaid_Map * | m, | |
| void * | key, | |||
| void * | value | |||
| ) |
Associates the given key with the give value.
| m | The map to associate key and value | |
| key | The key | |
| value | The data |
key with the value. If there is not already a node, a new node will be added to the collection. If the key has already an entry in the collection the old value will be overwritten by the new value. | CMAID_INLINE void cmaid_map_value_iter_attach | ( | Cmaid_Map * | m, | |
| Cmaid_Iter * | iter | |||
| ) |
Attaches an iterator to iterate over the values.
| m | The map to attach the iterator | |
| iter | The iterator to attach |
1.5.8