Function rcutils_hash_map_set

Function Documentation

rcutils_ret_t rcutils_hash_map_set(rcutils_hash_map_t *hash_map, const void *key, const void *value)

Set a key value pair in the hash_map, increasing capacity if necessary.

If the key already exists in the map then the value is updated to the new value provided. If it does not already exist then a new entry is added for the new key and value. The capacity will be increased if needed.

Attribute

Adherence

Allocates Memory

Yes

Thread-Safe

No

Uses Atomics

No

Lock-Free

Yes

Parameters:
  • hash_map[inout] rcutils_hash_map_t to be updated

  • key[in] hash_map key

  • value[in] value for given hash_map key

Returns:

RCUTILS_RET_OK if successful, or

Returns:

RCUTILS_RET_INVALID_ARGUMENT for invalid arguments, or

Returns:

RCUTILS_RET_BAD_ALLOC if memory allocation fails, or

Returns:

RCUTILS_RET_NOT_INITIALIZED if the hash_map is invalid, or

Returns:

RCUTILS_RET_ERROR if an unknown error occurs.