Function rosidl_runtime_c_type_description_utils_get_referenced_type_description_map

Function Documentation

rcutils_ret_t rosidl_runtime_c_type_description_utils_get_referenced_type_description_map(const rosidl_runtime_c__type_description__IndividualTypeDescription__Sequence *referenced_types, const rcutils_allocator_t *allocator, rcutils_hash_map_t **hash_map)

Construct a hash map of an IndividualTypeDescription__Sequence’s IndividualTypeDescription objects, keyed by type name. The hash_map output arg must be passed in pointing to NULL. Furthermore, if the input referenced_types sequence has types with identical names but differing structures, this function will return RCUTILS_RET_INVALID_ARGUMENT and fail.

Ownership:

  • The caller assumes ownership of the output rcutils_hash_map_t and must free it and its elements, but NOT finalize its values.

  • The output rcutils_hash_map_t has values that borrows the referenced_types arg’s IndividualTypeDescription elements. It is not authorized to deallocate them and it cannot outlive the referenced_types it borrows from.

    • Finalizing the output rcutils_hash_map_t should not result in its values getting finalized.

Attribute

Adherence

Allocates Memory

Yes

Thread-Safe

No

Uses Atomics

No

Lock-Free

Yes

Parameters:
  • referenced_types[in] the referenced individual type descriptions to get the referenced types from

  • allocator[in] the allocator to use through out the lifetime of the hash_map

  • hash_map[out] rcutils_hash_map_t to be initialized, containing IndividualTypeDescription objects keyed by their type names. Must point to NULL, outputs pointing to NULL if error.

Returns:

#RCUTILS_RET_OK if successful, or

Returns:

#RCUTILS_RET_BAD_ALLOC if memory allocation fails, or

Returns:

#RCUTILS_RET_INVALID_ARGUMENT for invalid arguments, or

Returns:

#RCUTILS_RET_ERROR if an unknown error occurs.