Function rcutils_string_map_get
Defined in File string_map.h
Function Documentation
-
const char *rcutils_string_map_get(const rcutils_string_map_t *string_map, const char *key)
Get value given a key.
The key needs to be a null terminated c string.
This function can fail, and therefore return NULL, if the key is not found, or the string_map is NULL or invalid, or if the key is NULL. In all cases no error message is set.
The returned value string is still owned by the map, and it should not be modified or free’d. This also means that the value pointer becomes invalid if either rcutils_string_map_clear() or rcutils_string_map_fini() are called or if the key value pair is updated or removed with one of rcutils_string_map_set() or rcutils_string_map_set_no_resize() or rcutils_string_map_unset().
- Parameters:
string_map – [in] rcutils_string_map_t to be searched
key – [in] map key, must be null terminated c string
- Returns:
value for the given key if successful, or
- Returns:
NULL
for invalid arguments, or- Returns:
NULL
if the string map is invalid, or- Returns:
NULL
if key not found, or- Returns:
NULL
if an unknown error occurs.