Function rosidl_runtime_c_type_description_utils_create_field

Function Documentation

rcutils_ret_t rosidl_runtime_c_type_description_utils_create_field(const char *name, size_t name_length, uint8_t type_id, uint64_t capacity, uint64_t string_capacity, const char *nested_type_name, size_t nested_type_name_length, const char *default_value, size_t default_value_length, rosidl_runtime_c__type_description__Field **field)

Construct a new populated Field object.

NOTE: The field output arg must be passed in pointing to NULL.

Ownership:

  • The caller assumes ownership of the output Field and must free it and its members.

  • The char * members are copied.

Attribute

Adherence

Allocates Memory

Yes

Thread-Safe

No

Uses Atomics

No

Lock-Free

Yes

Parameters:
  • name[in] the name of the field

  • name_length[in] the string length of name (not counting the null terminator)

  • type_id[in] the type id of the field (follows the type_description_interfaces definition)

  • capacity[in] capacity of the field (if it is an array or sequence)

  • string_capacity[in] capacity of string elements (if the field is an array or sequence of strings)

  • nested_type_name[in] the nested type name of the field (if it is a nested type)

  • nested_type_name_length[in] the string length of nested_type_name (not counting the null terminator)

  • default_value[in] literal default value of the field as a string, as it appeared in the original message definition

  • default_value_length[in] the string length of default_value (not counting the null terminator)

  • field[out] Field to be initialized. 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.