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

Fix array get_function semantics #448

Merged
merged 2 commits into from
Sep 24, 2020
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -197,32 +197,6 @@ void serialize_field<std::wstring>(
}
}

inline
void * get_subros_message(
const rosidl_typesupport_introspection_cpp::MessageMember * member,
void * field,
size_t index,
size_t,
bool)
{
return member->get_function(field, index);
}

inline
void * get_subros_message(
const rosidl_typesupport_introspection_c__MessageMember * member,
void * field,
size_t index,
size_t array_size,
bool is_upper_bound)
{
if (array_size && !is_upper_bound) {
return member->get_function(&field, index);
}

return member->get_function(field, index);
}

template<typename MembersType>
bool TypeSupport<MembersType>::serializeROSmessage(
eprosima::fastcdr::Cdr & ser,
Expand Down Expand Up @@ -309,11 +283,7 @@ bool TypeSupport<MembersType>::serializeROSmessage(
return false;
}
for (size_t index = 0; index < array_size; ++index) {
serializeROSmessage(
ser, sub_members,
get_subros_message(
member, field, index, member->array_size_,
member->is_upper_bound_));
serializeROSmessage(ser, sub_members, member->get_function(field, index));
}
}
}
Expand Down Expand Up @@ -572,9 +542,7 @@ size_t TypeSupport<MembersType>::getEstimatedSerializedSize(
for (size_t index = 0; index < array_size; ++index) {
current_alignment += getEstimatedSerializedSize(
sub_members,
get_subros_message(
member, field, index, member->array_size_,
member->is_upper_bound_),
member->get_function(field, index),
current_alignment);
}
}
Expand Down Expand Up @@ -826,11 +794,7 @@ bool TypeSupport<MembersType>::deserializeROSmessage(
return false;
}
for (size_t index = 0; index < array_size; ++index) {
deserializeROSmessage(
deser, sub_members,
get_subros_message(
member, field, index, member->array_size_,
member->is_upper_bound_));
deserializeROSmessage(deser, sub_members, member->get_function(field, index));
}
}
}
Expand Down