rcutils
master
C API providing common utilities and data structures.
|
Go to the documentation of this file.
17 #ifndef RCUTILS__TYPES__STRING_MAP_H_
18 #define RCUTILS__TYPES__STRING_MAP_H_
32 struct rcutils_string_map_impl_t;
38 struct rcutils_string_map_impl_t *
impl;
102 size_t initial_capacity,
443 #endif // RCUTILS__TYPES__STRING_MAP_H_
bool rcutils_string_map_key_existsn(const rcutils_string_map_t *string_map, const char *key, size_t key_length)
Get whether or not a key of known length exists.
struct rcutils_string_map_impl_t * impl
A pointer to the PIMPL implementation type.
Definition: string_map.h:38
rcutils_string_map_t rcutils_get_zero_initialized_string_map()
Return an empty string map struct.
bool rcutils_string_map_key_exists(const rcutils_string_map_t *string_map, const char *key)
Get whether or not a key exists.
rcutils_ret_t rcutils_string_map_get_capacity(const rcutils_string_map_t *string_map, size_t *capacity)
Get the current capacity of the string map.
const char * rcutils_string_map_getn(const rcutils_string_map_t *string_map, const char *key, size_t key_length)
Get value given a key and key length.
rcutils_ret_t rcutils_string_map_set_no_resize(rcutils_string_map_t *string_map, const char *key, const char *value)
Set a key value pair in the map but only if the map has enough capacity.
rcutils_ret_t rcutils_string_map_reserve(rcutils_string_map_t *string_map, size_t capacity)
Reserve a given amount of capacity in the map.
rcutils_ret_t rcutils_string_map_unset(rcutils_string_map_t *string_map, const char *key)
Unset a key value pair in the map.
#define RCUTILS_PUBLIC_TYPE
Definition: visibility_control.h:29
rcutils_ret_t rcutils_string_map_copy(const rcutils_string_map_t *src_string_map, rcutils_string_map_t *dst_string_map)
Copy all the key value pairs from one map into another, overwritting and resizing if needed.
The structure holding the metadata for a string map.
Definition: string_map.h:35
int rcutils_ret_t
The type that holds a return value for an rcutils operation.
Definition: rcutils_ret.h:26
const char * rcutils_string_map_get(const rcutils_string_map_t *string_map, const char *key)
Get value given a key.
#define RCUTILS_WARN_UNUSED
A macro to make the compiler warn when the return value of a function is not used.
Definition: macros.h:27
const char * rcutils_string_map_get_next_key(const rcutils_string_map_t *string_map, const char *key)
Get the next key in the map, unless NULL is given, then get the first key.
struct rcutils_string_map_t rcutils_string_map_t
The structure holding the metadata for a string map.
Encapsulation of an allocator.
Definition: allocator.h:47
rcutils_ret_t rcutils_string_map_set(rcutils_string_map_t *string_map, const char *key, const char *value)
Set a key value pair in the map, increasing capacity if necessary.
#define RCUTILS_PUBLIC
Definition: visibility_control.h:23
rcutils_ret_t rcutils_string_map_get_size(const rcutils_string_map_t *string_map, size_t *size)
Get the current size of the string map.
rcutils_ret_t rcutils_string_map_fini(rcutils_string_map_t *string_map)
Finalize the previously initialized string map struct.
rcutils_ret_t rcutils_string_map_clear(rcutils_string_map_t *string_map)
Remove all key value pairs from the map.
rcutils_ret_t rcutils_string_map_init(rcutils_string_map_t *string_map, size_t initial_capacity, rcutils_allocator_t allocator)
Initialize a rcutils_string_map_t, allocating space for given capacity.