Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tick-tock _complex_value -> _nested_data #13

Open
wants to merge 1 commit into
base: rolling
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 46 additions & 1 deletion include/rosidl_dynamic_typesupport/api/dynamic_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,40 @@ rosidl_dynamic_typesupport_dynamic_data_insert_bounded_wstring_value(
// The user is expected to allocate the '** value' outparam outside
// This function will then reassign the '** value''s 'serialization_support' member to match the
// input's

ROSIDL_DYNAMIC_TYPESUPPORT_PUBLIC
rcutils_ret_t
rosidl_dynamic_typesupport_dynamic_data_get_nested_data(
const rosidl_dynamic_typesupport_dynamic_data_t * dynamic_data,
rosidl_dynamic_typesupport_member_id_t id,
rcutils_allocator_t * allocator,
rosidl_dynamic_typesupport_dynamic_data_t * value);

ROSIDL_DYNAMIC_TYPESUPPORT_PUBLIC
rcutils_ret_t
rosidl_dynamic_typesupport_dynamic_data_set_nested_data(
rosidl_dynamic_typesupport_dynamic_data_t * dynamic_data,
rosidl_dynamic_typesupport_member_id_t id, rosidl_dynamic_typesupport_dynamic_data_t * value);

// This deep copies the passed data
ROSIDL_DYNAMIC_TYPESUPPORT_PUBLIC
rcutils_ret_t
rosidl_dynamic_typesupport_dynamic_data_insert_nested_data_copy(
rosidl_dynamic_typesupport_dynamic_data_t * dynamic_data,
const rosidl_dynamic_typesupport_dynamic_data_t * value,
rosidl_dynamic_typesupport_member_id_t * out_id);

ROSIDL_DYNAMIC_TYPESUPPORT_PUBLIC
rcutils_ret_t
rosidl_dynamic_typesupport_dynamic_data_insert_nested_data(
rosidl_dynamic_typesupport_dynamic_data_t * dynamic_data,
rosidl_dynamic_typesupport_dynamic_data_t * value,
rosidl_dynamic_typesupport_member_id_t * out_id);

/**
* \deprecated `rosidl_dynamic_typesupport_dynamic_data_get_complex_value` is deprecated in favor of
* `rosidl_dynamic_typesupport_dynamic_data_get_nested_data`
*/
ROSIDL_DYNAMIC_TYPESUPPORT_PUBLIC
rcutils_ret_t
rosidl_dynamic_typesupport_dynamic_data_get_complex_value(
Expand All @@ -590,20 +624,31 @@ rosidl_dynamic_typesupport_dynamic_data_get_complex_value(
rcutils_allocator_t * allocator,
rosidl_dynamic_typesupport_dynamic_data_t * value);

/**
* \deprecated `rosidl_dynamic_typesupport_dynamic_data_set_complex_value` is deprecated in favor of
* `rosidl_dynamic_typesupport_dynamic_data_set_nested_data`
*/
ROSIDL_DYNAMIC_TYPESUPPORT_PUBLIC
rcutils_ret_t
rosidl_dynamic_typesupport_dynamic_data_set_complex_value(
rosidl_dynamic_typesupport_dynamic_data_t * dynamic_data,
rosidl_dynamic_typesupport_member_id_t id, rosidl_dynamic_typesupport_dynamic_data_t * value);

// This deep copies the passed data
/**
* \deprecated `rosidl_dynamic_typesupport_dynamic_data_insert_complex_value_copy` is deprecated in
* favor of `rosidl_dynamic_typesupport_dynamic_data_insert_nested_data_copy`
*/
ROSIDL_DYNAMIC_TYPESUPPORT_PUBLIC
rcutils_ret_t
rosidl_dynamic_typesupport_dynamic_data_insert_complex_value_copy(
rosidl_dynamic_typesupport_dynamic_data_t * dynamic_data,
const rosidl_dynamic_typesupport_dynamic_data_t * value,
rosidl_dynamic_typesupport_member_id_t * out_id);

/**
* \deprecated `rosidl_dynamic_typesupport_dynamic_data_insert_complex_value` is deprecated in favor of
* `rosidl_dynamic_typesupport_dynamic_data_insert_nested_data`
*/
ROSIDL_DYNAMIC_TYPESUPPORT_PUBLIC
rcutils_ret_t
rosidl_dynamic_typesupport_dynamic_data_insert_complex_value(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1318,26 +1318,68 @@ struct rosidl_dynamic_typesupport_serialization_support_interface_s


// DYNAMIC DATA NESTED

rcutils_ret_t (* dynamic_data_get_nested_data)(
rosidl_dynamic_typesupport_serialization_support_impl_t * serialization_support,
const rosidl_dynamic_typesupport_dynamic_data_impl_t * dynamic_data,
rosidl_dynamic_typesupport_member_id_t id,
rcutils_allocator_t * allocator,
rosidl_dynamic_typesupport_dynamic_data_impl_t * value); // OUT (copies)

rcutils_ret_t (* dynamic_data_set_nested_data)(
rosidl_dynamic_typesupport_serialization_support_impl_t * serialization_support,
rosidl_dynamic_typesupport_dynamic_data_impl_t * dynamic_data,
rosidl_dynamic_typesupport_member_id_t id,
rosidl_dynamic_typesupport_dynamic_data_impl_t * value);

// This deep copies the passed data
rcutils_ret_t (* dynamic_data_insert_nested_data_copy)(
rosidl_dynamic_typesupport_serialization_support_impl_t * serialization_support,
rosidl_dynamic_typesupport_dynamic_data_impl_t * dynamic_data,
const rosidl_dynamic_typesupport_dynamic_data_impl_t * value,
rosidl_dynamic_typesupport_member_id_t * out_id); // OUT

rcutils_ret_t (* dynamic_data_insert_nested_data)(
rosidl_dynamic_typesupport_serialization_support_impl_t * serialization_support,
rosidl_dynamic_typesupport_dynamic_data_impl_t * dynamic_data,
rosidl_dynamic_typesupport_dynamic_data_impl_t * value,
rosidl_dynamic_typesupport_member_id_t * out_id); // OUT

/**
* \deprecated `dynamic_data_get_complex_value` is deprecated in favor of
* `dynamic_data_get_nested_data`
*/
Comment on lines +1348 to +1351

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we just rename the fields in the struct?

I am assuming that the API of this package is the one in dynamic_data.h, and that the struct defined in this header is the interface that the implementations should provide.

Copy link
Collaborator Author

@methylDragon methylDragon Jan 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we rename it, rosidl_dynamic_typesupport_fastrps (and any other dependent packages) will be broken until the other PR is merged. I am fine if we're okay with that, since this is targeting rolling (and we don't have to care about ABI (?)), in which case we should merge the two PRs together.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need an opinion from the project lead. @clalancette what do you think?

rcutils_ret_t (* dynamic_data_get_complex_value)(
rosidl_dynamic_typesupport_serialization_support_impl_t * serialization_support,
const rosidl_dynamic_typesupport_dynamic_data_impl_t * dynamic_data,
rosidl_dynamic_typesupport_member_id_t id,
rcutils_allocator_t * allocator,
rosidl_dynamic_typesupport_dynamic_data_impl_t * value); // OUT (copies)

/**
* \deprecated `dynamic_data_set_complex_value` is deprecated in favor of
* `dynamic_data_set_nested_data`
*/
rcutils_ret_t (* dynamic_data_set_complex_value)(
rosidl_dynamic_typesupport_serialization_support_impl_t * serialization_support,
rosidl_dynamic_typesupport_dynamic_data_impl_t * dynamic_data,
rosidl_dynamic_typesupport_member_id_t id,
rosidl_dynamic_typesupport_dynamic_data_impl_t * value);


/**
* \deprecated `dynamic_data_insert_complex_value_copy` is deprecated in favor of
* `dynamic_data_insert_nested_data_copy`
*/
rcutils_ret_t (* dynamic_data_insert_complex_value_copy)(
rosidl_dynamic_typesupport_serialization_support_impl_t * serialization_support,
rosidl_dynamic_typesupport_dynamic_data_impl_t * dynamic_data,
const rosidl_dynamic_typesupport_dynamic_data_impl_t * value,
rosidl_dynamic_typesupport_member_id_t * out_id); // OUT

/**
* \deprecated `dynamic_data_insert_complex_value` is deprecated in favor of
* `dynamic_data_insert_nested_data`
*/
rcutils_ret_t (* dynamic_data_insert_complex_value)(
rosidl_dynamic_typesupport_serialization_support_impl_t * serialization_support,
rosidl_dynamic_typesupport_dynamic_data_impl_t * dynamic_data,
Expand Down
60 changes: 51 additions & 9 deletions src/api/dynamic_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ rosidl_dynamic_typesupport_dynamic_data_insert_bounded_wstring_value(

// DYNAMIC DATA NESTED =============================================================================
rcutils_ret_t
rosidl_dynamic_typesupport_dynamic_data_get_complex_value(
rosidl_dynamic_typesupport_dynamic_data_get_nested_data(
const rosidl_dynamic_typesupport_dynamic_data_t * dynamic_data,
rosidl_dynamic_typesupport_member_id_t id,
rcutils_allocator_t * allocator,
Expand All @@ -867,50 +867,92 @@ rosidl_dynamic_typesupport_dynamic_data_get_complex_value(
value->allocator = *allocator;

ROSIDL_DYNAMIC_TYPESUPPORT_CHECK_RET_FOR_NOT_OK_WITH_CLEANUP(
(dynamic_data->serialization_support->methods.dynamic_data_get_complex_value)(
(dynamic_data->serialization_support->methods.dynamic_data_get_nested_data)(
&dynamic_data->serialization_support->impl, &dynamic_data->impl, id, allocator, &value->impl),
rosidl_dynamic_typesupport_dynamic_data_fini(value) // Cleanup
rosidl_dynamic_typesupport_dynamic_data_fini(value) // Cleanup.
);
return RCUTILS_RET_OK;
}


rcutils_ret_t
rosidl_dynamic_typesupport_dynamic_data_set_complex_value(
rosidl_dynamic_typesupport_dynamic_data_set_nested_data(
rosidl_dynamic_typesupport_dynamic_data_t * dynamic_data,
rosidl_dynamic_typesupport_member_id_t id,
rosidl_dynamic_typesupport_dynamic_data_t * value)
{
RCUTILS_CHECK_ARGUMENT_FOR_NULL(dynamic_data, RCUTILS_RET_INVALID_ARGUMENT);
RCUTILS_CHECK_ARGUMENT_FOR_NULL(value, RCUTILS_RET_INVALID_ARGUMENT);
return (dynamic_data->serialization_support->methods.dynamic_data_set_complex_value)(
return (dynamic_data->serialization_support->methods.dynamic_data_set_nested_data)(
&dynamic_data->serialization_support->impl, &dynamic_data->impl, id, &value->impl);
}


rcutils_ret_t
rosidl_dynamic_typesupport_dynamic_data_insert_complex_value_copy(
rosidl_dynamic_typesupport_dynamic_data_insert_nested_data_copy(
rosidl_dynamic_typesupport_dynamic_data_t * dynamic_data,
const rosidl_dynamic_typesupport_dynamic_data_t * value,
rosidl_dynamic_typesupport_member_id_t * out_id)
{
RCUTILS_CHECK_ARGUMENT_FOR_NULL(dynamic_data, RCUTILS_RET_INVALID_ARGUMENT);
RCUTILS_CHECK_ARGUMENT_FOR_NULL(value, RCUTILS_RET_INVALID_ARGUMENT);
RCUTILS_CHECK_ARGUMENT_FOR_NULL(out_id, RCUTILS_RET_INVALID_ARGUMENT);
return (dynamic_data->serialization_support->methods.dynamic_data_insert_complex_value_copy)(
return (dynamic_data->serialization_support->methods.dynamic_data_insert_nested_data_copy)(
&dynamic_data->serialization_support->impl, &dynamic_data->impl, &value->impl, out_id);
}


rcutils_ret_t
rosidl_dynamic_typesupport_dynamic_data_insert_complex_value(
rosidl_dynamic_typesupport_dynamic_data_insert_nested_data(
rosidl_dynamic_typesupport_dynamic_data_t * dynamic_data,
rosidl_dynamic_typesupport_dynamic_data_t * value,
rosidl_dynamic_typesupport_member_id_t * out_id)
{
RCUTILS_CHECK_ARGUMENT_FOR_NULL(dynamic_data, RCUTILS_RET_INVALID_ARGUMENT);
RCUTILS_CHECK_ARGUMENT_FOR_NULL(value, RCUTILS_RET_INVALID_ARGUMENT);
RCUTILS_CHECK_ARGUMENT_FOR_NULL(out_id, RCUTILS_RET_INVALID_ARGUMENT);
return (dynamic_data->serialization_support->methods.dynamic_data_insert_complex_value)(
return (dynamic_data->serialization_support->methods.dynamic_data_insert_nested_data)(
&dynamic_data->serialization_support->impl, &dynamic_data->impl, &value->impl, out_id);
}


rcutils_ret_t
rosidl_dynamic_typesupport_dynamic_data_get_complex_value(
const rosidl_dynamic_typesupport_dynamic_data_t * dynamic_data,
rosidl_dynamic_typesupport_member_id_t id,
rcutils_allocator_t * allocator,
rosidl_dynamic_typesupport_dynamic_data_t * value)
{
return rosidl_dynamic_typesupport_dynamic_data_get_nested_data(dynamic_data, id, allocator, value);
}


rcutils_ret_t
rosidl_dynamic_typesupport_dynamic_data_set_complex_value(
rosidl_dynamic_typesupport_dynamic_data_t * dynamic_data,
rosidl_dynamic_typesupport_member_id_t id,
rosidl_dynamic_typesupport_dynamic_data_t * value)
{
return rosidl_dynamic_typesupport_dynamic_data_set_nested_data(dynamic_data, id, value);
}


rcutils_ret_t
rosidl_dynamic_typesupport_dynamic_data_insert_complex_value_copy(
rosidl_dynamic_typesupport_dynamic_data_t * dynamic_data,
const rosidl_dynamic_typesupport_dynamic_data_t * value,
rosidl_dynamic_typesupport_member_id_t * out_id)
{
return rosidl_dynamic_typesupport_dynamic_data_insert_nested_data_copy(
dynamic_data, value, out_id);
}


rcutils_ret_t
rosidl_dynamic_typesupport_dynamic_data_insert_complex_value(
rosidl_dynamic_typesupport_dynamic_data_t * dynamic_data,
rosidl_dynamic_typesupport_dynamic_data_t * value,
rosidl_dynamic_typesupport_member_id_t * out_id)
{
return rosidl_dynamic_typesupport_dynamic_data_insert_nested_data(dynamic_data, value, out_id);
}