Function rcutils_hash_map_get

Function Documentation

rcutils_ret_t rcutils_hash_map_get(const rcutils_hash_map_t *hash_map, const void *key, void *data)

Get value given a key.

This function can be used to retrieve a shallow copy of the stored data. The data pointer must point to a section of memory large enough to copy the full size of the data being stored, which is specified when the hash_map in initialized.

Attribute

Adherence

Allocates Memory

No

Thread-Safe

No

Uses Atomics

No

Lock-Free

Yes

Parameters:
  • hash_map[in] rcutils_hash_map_t to be searched

  • key[in] hash_map key to look up the data for

  • data[out] A copy of the data stored in the map

Returns:

RCUTILS_RET_OK if successful, or

Returns:

RCUTILS_RET_INVALID_ARGUMENT for invalid arguments, or

Returns:

RCUTILS_RET_NOT_INITIALIZED if the hash_map is invalid, or

Returns:

RCUTILS_RET_NOT_FOUND if the key doesn’t exist in the map, or

Returns:

RCUTILS_RET_ERROR if an unknown error occurs.