From 12c293adde7da87aa08725ea54574df7a4524c14 Mon Sep 17 00:00:00 2001 From: Ivan Santiago Paunovic Date: Thu, 24 Sep 2020 10:48:55 -0300 Subject: [PATCH 1/2] Update to new get_function and get_const_function semantics in arrays Signed-off-by: Ivan Santiago Paunovic --- .../TypeSupport_impl.hpp | 42 ++----------------- 1 file changed, 3 insertions(+), 39 deletions(-) diff --git a/rmw_fastrtps_dynamic_cpp/include/rmw_fastrtps_dynamic_cpp/TypeSupport_impl.hpp b/rmw_fastrtps_dynamic_cpp/include/rmw_fastrtps_dynamic_cpp/TypeSupport_impl.hpp index da919d77d..0c0fe2227 100644 --- a/rmw_fastrtps_dynamic_cpp/include/rmw_fastrtps_dynamic_cpp/TypeSupport_impl.hpp +++ b/rmw_fastrtps_dynamic_cpp/include/rmw_fastrtps_dynamic_cpp/TypeSupport_impl.hpp @@ -197,32 +197,6 @@ void serialize_field( } } -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 bool TypeSupport::serializeROSmessage( eprosima::fastcdr::Cdr & ser, @@ -309,11 +283,7 @@ bool TypeSupport::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)); } } } @@ -572,9 +542,7 @@ size_t TypeSupport::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, i), current_alignment); } } @@ -826,11 +794,7 @@ bool TypeSupport::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, i)); } } } From 7d14c711b85cf627ad83b20055011f972989df88 Mon Sep 17 00:00:00 2001 From: Ivan Santiago Paunovic Date: Thu, 24 Sep 2020 12:42:59 -0300 Subject: [PATCH 2/2] fix bad copy-pasting Signed-off-by: Ivan Santiago Paunovic --- .../include/rmw_fastrtps_dynamic_cpp/TypeSupport_impl.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rmw_fastrtps_dynamic_cpp/include/rmw_fastrtps_dynamic_cpp/TypeSupport_impl.hpp b/rmw_fastrtps_dynamic_cpp/include/rmw_fastrtps_dynamic_cpp/TypeSupport_impl.hpp index 0c0fe2227..398c300fc 100644 --- a/rmw_fastrtps_dynamic_cpp/include/rmw_fastrtps_dynamic_cpp/TypeSupport_impl.hpp +++ b/rmw_fastrtps_dynamic_cpp/include/rmw_fastrtps_dynamic_cpp/TypeSupport_impl.hpp @@ -542,7 +542,7 @@ size_t TypeSupport::getEstimatedSerializedSize( for (size_t index = 0; index < array_size; ++index) { current_alignment += getEstimatedSerializedSize( sub_members, - member->get_function(field, i), + member->get_function(field, index), current_alignment); } } @@ -794,7 +794,7 @@ bool TypeSupport::deserializeROSmessage( return false; } for (size_t index = 0; index < array_size; ++index) { - deserializeROSmessage(deser, sub_members, member->get_function(field, i)); + deserializeROSmessage(deser, sub_members, member->get_function(field, index)); } } }