From 2090bd3e21d2a2977e69b905e73addb543e4b14a Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Tue, 30 Apr 2019 14:40:15 -0500 Subject: [PATCH 1/4] Updates for preallocation API. Signed-off-by: Michael Carroll --- rmw_fastrtps_cpp/src/rmw_publish.cpp | 5 +++-- rmw_fastrtps_cpp/src/rmw_publisher.cpp | 21 +++++++++++++++++++ rmw_fastrtps_cpp/src/rmw_subscription.cpp | 21 +++++++++++++++++++ rmw_fastrtps_cpp/src/rmw_take.cpp | 15 +++++++++---- rmw_fastrtps_dynamic_cpp/src/rmw_publish.cpp | 7 +++++-- .../src/rmw_publisher.cpp | 21 +++++++++++++++++++ .../src/rmw_subscription.cpp | 21 +++++++++++++++++++ rmw_fastrtps_dynamic_cpp/src/rmw_take.cpp | 13 ++++++++---- .../rmw_fastrtps_shared_cpp/rmw_common.hpp | 9 +++++--- rmw_fastrtps_shared_cpp/src/rmw_publish.cpp | 4 +++- rmw_fastrtps_shared_cpp/src/rmw_take.cpp | 14 ++++++++----- 11 files changed, 130 insertions(+), 21 deletions(-) diff --git a/rmw_fastrtps_cpp/src/rmw_publish.cpp b/rmw_fastrtps_cpp/src/rmw_publish.cpp index 26e8cbc9e..93e367b96 100644 --- a/rmw_fastrtps_cpp/src/rmw_publish.cpp +++ b/rmw_fastrtps_cpp/src/rmw_publish.cpp @@ -26,10 +26,11 @@ extern "C" { rmw_ret_t -rmw_publish(const rmw_publisher_t * publisher, const void * ros_message) +rmw_publish(const rmw_publisher_t * publisher, const void * ros_message, rmw_publisher_allocation_t * allocation) { + (void) allocation; return rmw_fastrtps_shared_cpp::__rmw_publish( - eprosima_fastrtps_identifier, publisher, ros_message); + eprosima_fastrtps_identifier, publisher, ros_message, allocation); } rmw_ret_t diff --git a/rmw_fastrtps_cpp/src/rmw_publisher.cpp b/rmw_fastrtps_cpp/src/rmw_publisher.cpp index 5c68307d8..6e9bfb5f9 100644 --- a/rmw_fastrtps_cpp/src/rmw_publisher.cpp +++ b/rmw_fastrtps_cpp/src/rmw_publisher.cpp @@ -34,6 +34,27 @@ using TopicDataType = eprosima::fastrtps::TopicDataType; extern "C" { +rmw_ret_t +rmw_init_publisher_allocation( + const rosidl_message_type_support_t * type_supports, + const rosidl_message_bounds_t * message_bounds, + rmw_publisher_allocation_t * allocation) +{ + (void) type_supports; + (void) message_bounds; + (void) allocation; + RMW_SET_ERROR_MSG("not implemented."); + return RMW_RET_ERROR; +} + +rmw_ret_t +rmw_fini_publisher_allocation(rmw_publisher_allocation_t * allocation) +{ + (void) allocation; + RMW_SET_ERROR_MSG("not implemented."); + return RMW_RET_ERROR; +} + rmw_publisher_t * rmw_create_publisher( const rmw_node_t * node, diff --git a/rmw_fastrtps_cpp/src/rmw_subscription.cpp b/rmw_fastrtps_cpp/src/rmw_subscription.cpp index 713e98f9f..6bd552b09 100644 --- a/rmw_fastrtps_cpp/src/rmw_subscription.cpp +++ b/rmw_fastrtps_cpp/src/rmw_subscription.cpp @@ -38,6 +38,27 @@ using TopicDataType = eprosima::fastrtps::TopicDataType; extern "C" { +rmw_ret_t +rmw_init_subscription_allocation( + const rosidl_message_type_support_t * type_supports, + const rosidl_message_bounds_t * message_bounds, + rmw_subscription_allocation_t * allocation) +{ + (void) type_supports; + (void) message_bounds; + (void) allocation; + RMW_SET_ERROR_MSG("not implemented."); + return RMW_RET_ERROR; +} + +rmw_ret_t +rmw_fini_subscription_allocation(rmw_subscription_allocation_t * allocation) +{ + (void) allocation; + RMW_SET_ERROR_MSG("not implemented."); + return RMW_RET_ERROR; +} + rmw_subscription_t * rmw_create_subscription( const rmw_node_t * node, diff --git a/rmw_fastrtps_cpp/src/rmw_take.cpp b/rmw_fastrtps_cpp/src/rmw_take.cpp index 849c19825..483a74f3e 100644 --- a/rmw_fastrtps_cpp/src/rmw_take.cpp +++ b/rmw_fastrtps_cpp/src/rmw_take.cpp @@ -24,10 +24,15 @@ extern "C" { rmw_ret_t -rmw_take(const rmw_subscription_t * subscription, void * ros_message, bool * taken) +rmw_take( + const rmw_subscription_t * subscription, + void * ros_message, + bool * taken, + rmw_subscription_allocation_t * allocation) { + (void) allocation; return rmw_fastrtps_shared_cpp::__rmw_take( - eprosima_fastrtps_identifier, subscription, ros_message, taken); + eprosima_fastrtps_identifier, subscription, ros_message, taken, allocation); } rmw_ret_t @@ -35,10 +40,12 @@ rmw_take_with_info( const rmw_subscription_t * subscription, void * ros_message, bool * taken, - rmw_message_info_t * message_info) + rmw_message_info_t * message_info, + rmw_subscription_allocation_t * allocation) { + (void) allocation; return rmw_fastrtps_shared_cpp::__rmw_take_with_info( - eprosima_fastrtps_identifier, subscription, ros_message, taken, message_info); + eprosima_fastrtps_identifier, subscription, ros_message, taken, message_info, allocation); } rmw_ret_t diff --git a/rmw_fastrtps_dynamic_cpp/src/rmw_publish.cpp b/rmw_fastrtps_dynamic_cpp/src/rmw_publish.cpp index 6a5e414b1..d6817fbc1 100644 --- a/rmw_fastrtps_dynamic_cpp/src/rmw_publish.cpp +++ b/rmw_fastrtps_dynamic_cpp/src/rmw_publish.cpp @@ -26,10 +26,13 @@ extern "C" { rmw_ret_t -rmw_publish(const rmw_publisher_t * publisher, const void * ros_message) +rmw_publish( + const rmw_publisher_t * publisher, + const void * ros_message, + rmw_publisher_allocation_t * allocation) { return rmw_fastrtps_shared_cpp::__rmw_publish( - eprosima_fastrtps_identifier, publisher, ros_message); + eprosima_fastrtps_identifier, publisher, ros_message, allocation); } rmw_ret_t diff --git a/rmw_fastrtps_dynamic_cpp/src/rmw_publisher.cpp b/rmw_fastrtps_dynamic_cpp/src/rmw_publisher.cpp index 422a66066..7f9eb6379 100644 --- a/rmw_fastrtps_dynamic_cpp/src/rmw_publisher.cpp +++ b/rmw_fastrtps_dynamic_cpp/src/rmw_publisher.cpp @@ -33,6 +33,27 @@ using TopicDataType = eprosima::fastrtps::TopicDataType; extern "C" { +rmw_ret_t +rmw_init_publisher_allocation( + const rosidl_message_type_support_t * type_supports, + const rosidl_message_bounds_t * message_bounds, + rmw_publisher_allocation_t * allocation) +{ + (void) type_supports; + (void) message_bounds; + (void) allocation; + RMW_SET_ERROR_MSG("not implemented."); + return RMW_RET_ERROR; +} + +rmw_ret_t +rmw_fini_publisher_allocation(rmw_publisher_allocation_t * allocation) +{ + (void) allocation; + RMW_SET_ERROR_MSG("not implemented."); + return RMW_RET_ERROR; +} + rmw_publisher_t * rmw_create_publisher( const rmw_node_t * node, diff --git a/rmw_fastrtps_dynamic_cpp/src/rmw_subscription.cpp b/rmw_fastrtps_dynamic_cpp/src/rmw_subscription.cpp index e0aa1864b..7f01e7e61 100644 --- a/rmw_fastrtps_dynamic_cpp/src/rmw_subscription.cpp +++ b/rmw_fastrtps_dynamic_cpp/src/rmw_subscription.cpp @@ -38,6 +38,27 @@ using TopicDataType = eprosima::fastrtps::TopicDataType; extern "C" { +rmw_ret_t +rmw_init_subscription_allocation( + const rosidl_message_type_support_t * type_supports, + const rosidl_message_bounds_t * message_bounds, + rmw_subscription_allocation_t * allocation) +{ + (void) type_supports; + (void) message_bounds; + (void) allocation; + RMW_SET_ERROR_MSG("not implemented."); + return RMW_RET_ERROR; +} + +rmw_ret_t +rmw_fini_subscription_allocation(rmw_subscription_allocation_t * allocation) +{ + (void) allocation; + RMW_SET_ERROR_MSG("not implemented."); + return RMW_RET_ERROR; +} + rmw_subscription_t * rmw_create_subscription( const rmw_node_t * node, diff --git a/rmw_fastrtps_dynamic_cpp/src/rmw_take.cpp b/rmw_fastrtps_dynamic_cpp/src/rmw_take.cpp index ce9192fa4..70ec9c69e 100644 --- a/rmw_fastrtps_dynamic_cpp/src/rmw_take.cpp +++ b/rmw_fastrtps_dynamic_cpp/src/rmw_take.cpp @@ -24,10 +24,14 @@ extern "C" { rmw_ret_t -rmw_take(const rmw_subscription_t * subscription, void * ros_message, bool * taken) +rmw_take( + const rmw_subscription_t * subscription, + void * ros_message, + bool * taken, + rmw_subscription_allocation_t * allocation) { return rmw_fastrtps_shared_cpp::__rmw_take( - eprosima_fastrtps_identifier, subscription, ros_message, taken); + eprosima_fastrtps_identifier, subscription, ros_message, taken, allocation); } rmw_ret_t @@ -35,10 +39,11 @@ rmw_take_with_info( const rmw_subscription_t * subscription, void * ros_message, bool * taken, - rmw_message_info_t * message_info) + rmw_message_info_t * message_info, + rmw_subscription_allocation_t * allocation) { return rmw_fastrtps_shared_cpp::__rmw_take_with_info( - eprosima_fastrtps_identifier, subscription, ros_message, taken, message_info); + eprosima_fastrtps_identifier, subscription, ros_message, taken, message_info, allocation); } rmw_ret_t diff --git a/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/rmw_common.hpp b/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/rmw_common.hpp index 5824c95c5..de22ed597 100644 --- a/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/rmw_common.hpp +++ b/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/rmw_common.hpp @@ -113,7 +113,8 @@ rmw_ret_t __rmw_publish( const char * identifier, const rmw_publisher_t * publisher, - const void * ros_message); + const void * ros_message, + rmw_publisher_allocation_t * allocation); RMW_FASTRTPS_SHARED_CPP_PUBLIC rmw_ret_t @@ -249,7 +250,8 @@ __rmw_take( const char * identifier, const rmw_subscription_t * subscription, void * ros_message, - bool * taken); + bool * taken, + rmw_subscription_allocation_t * allocation); RMW_FASTRTPS_SHARED_CPP_PUBLIC rmw_ret_t @@ -258,7 +260,8 @@ __rmw_take_with_info( const rmw_subscription_t * subscription, void * ros_message, bool * taken, - rmw_message_info_t * message_info); + rmw_message_info_t * message_info, + rmw_subscription_allocation_t * allocation); RMW_FASTRTPS_SHARED_CPP_PUBLIC rmw_ret_t diff --git a/rmw_fastrtps_shared_cpp/src/rmw_publish.cpp b/rmw_fastrtps_shared_cpp/src/rmw_publish.cpp index 6d9cc6ea9..16054881c 100644 --- a/rmw_fastrtps_shared_cpp/src/rmw_publish.cpp +++ b/rmw_fastrtps_shared_cpp/src/rmw_publish.cpp @@ -29,8 +29,10 @@ rmw_ret_t __rmw_publish( const char * identifier, const rmw_publisher_t * publisher, - const void * ros_message) + const void * ros_message, + rmw_publisher_allocation_t * allocation) { + (void) allocation; RCUTILS_CHECK_FOR_NULL_WITH_MSG(publisher, "publisher pointer is null", return RMW_RET_ERROR); RCUTILS_CHECK_FOR_NULL_WITH_MSG( ros_message, "ros_message pointer is null", return RMW_RET_ERROR); diff --git a/rmw_fastrtps_shared_cpp/src/rmw_take.cpp b/rmw_fastrtps_shared_cpp/src/rmw_take.cpp index 873816cfc..432eb8bf7 100644 --- a/rmw_fastrtps_shared_cpp/src/rmw_take.cpp +++ b/rmw_fastrtps_shared_cpp/src/rmw_take.cpp @@ -49,8 +49,10 @@ _take( const rmw_subscription_t * subscription, void * ros_message, bool * taken, - rmw_message_info_t * message_info) + rmw_message_info_t * message_info, + rmw_subscription_allocation_t * allocation) { + (void) allocation; *taken = false; if (subscription->implementation_identifier != identifier) { @@ -85,7 +87,8 @@ __rmw_take( const char * identifier, const rmw_subscription_t * subscription, void * ros_message, - bool * taken) + bool * taken, + rmw_subscription_allocation_t * allocation) { RCUTILS_CHECK_FOR_NULL_WITH_MSG( subscription, "subscription pointer is null", return RMW_RET_ERROR); @@ -93,7 +96,7 @@ __rmw_take( ros_message, "ros_message pointer is null", return RMW_RET_ERROR); RCUTILS_CHECK_FOR_NULL_WITH_MSG(taken, "boolean flag for taken is null", return RMW_RET_ERROR); - return _take(identifier, subscription, ros_message, taken, nullptr); + return _take(identifier, subscription, ros_message, taken, nullptr, allocation); } rmw_ret_t @@ -102,7 +105,8 @@ __rmw_take_with_info( const rmw_subscription_t * subscription, void * ros_message, bool * taken, - rmw_message_info_t * message_info) + rmw_message_info_t * message_info, + rmw_subscription_allocation_t * allocation) { RCUTILS_CHECK_FOR_NULL_WITH_MSG( subscription, "subscription pointer is null", return RMW_RET_ERROR); @@ -112,7 +116,7 @@ __rmw_take_with_info( RCUTILS_CHECK_FOR_NULL_WITH_MSG( message_info, "message info pointer is null", return RMW_RET_ERROR); - return _take(identifier, subscription, ros_message, taken, message_info); + return _take(identifier, subscription, ros_message, taken, message_info, allocation); } rmw_ret_t From d53d48527626fd7f42616c169e8ee2a6e4c4955a Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Wed, 1 May 2019 11:02:25 -0500 Subject: [PATCH 2/4] Add allocation to serialized methods. Signed-off-by: Michael Carroll --- rmw_fastrtps_cpp/src/rmw_publish.cpp | 11 ++++++++--- rmw_fastrtps_cpp/src/rmw_publisher.cpp | 12 ++++++------ rmw_fastrtps_cpp/src/rmw_subscription.cpp | 15 ++++++++------- rmw_fastrtps_cpp/src/rmw_take.cpp | 11 +++++++---- rmw_fastrtps_dynamic_cpp/src/rmw_publish.cpp | 6 ++++-- rmw_fastrtps_dynamic_cpp/src/rmw_publisher.cpp | 12 ++++++------ rmw_fastrtps_dynamic_cpp/src/rmw_subscription.cpp | 12 ++++++------ rmw_fastrtps_dynamic_cpp/src/rmw_take.cpp | 11 +++++++---- .../rmw_fastrtps_shared_cpp/rmw_common.hpp | 9 ++++++--- rmw_fastrtps_shared_cpp/src/rmw_publish.cpp | 4 +++- rmw_fastrtps_shared_cpp/src/rmw_take.cpp | 15 ++++++++++----- 11 files changed, 71 insertions(+), 47 deletions(-) diff --git a/rmw_fastrtps_cpp/src/rmw_publish.cpp b/rmw_fastrtps_cpp/src/rmw_publish.cpp index 93e367b96..966eb1ac1 100644 --- a/rmw_fastrtps_cpp/src/rmw_publish.cpp +++ b/rmw_fastrtps_cpp/src/rmw_publish.cpp @@ -26,7 +26,10 @@ extern "C" { rmw_ret_t -rmw_publish(const rmw_publisher_t * publisher, const void * ros_message, rmw_publisher_allocation_t * allocation) +rmw_publish( + const rmw_publisher_t * publisher, + const void * ros_message, + rmw_publisher_allocation_t * allocation) { (void) allocation; return rmw_fastrtps_shared_cpp::__rmw_publish( @@ -35,9 +38,11 @@ rmw_publish(const rmw_publisher_t * publisher, const void * ros_message, rmw_pub rmw_ret_t rmw_publish_serialized_message( - const rmw_publisher_t * publisher, const rmw_serialized_message_t * serialized_message) + const rmw_publisher_t * publisher, + const rmw_serialized_message_t * serialized_message, + rmw_publisher_allocation_t * allocation) { return rmw_fastrtps_shared_cpp::__rmw_publish_serialized_message( - eprosima_fastrtps_identifier, publisher, serialized_message); + eprosima_fastrtps_identifier, publisher, serialized_message, allocation); } } // extern "C" diff --git a/rmw_fastrtps_cpp/src/rmw_publisher.cpp b/rmw_fastrtps_cpp/src/rmw_publisher.cpp index 6e9bfb5f9..6fb15ac1c 100644 --- a/rmw_fastrtps_cpp/src/rmw_publisher.cpp +++ b/rmw_fastrtps_cpp/src/rmw_publisher.cpp @@ -36,23 +36,23 @@ extern "C" { rmw_ret_t rmw_init_publisher_allocation( - const rosidl_message_type_support_t * type_supports, + const rosidl_message_type_support_t * type_support, const rosidl_message_bounds_t * message_bounds, rmw_publisher_allocation_t * allocation) { - (void) type_supports; + // Unused in current implementation. + (void) type_support; (void) message_bounds; (void) allocation; - RMW_SET_ERROR_MSG("not implemented."); - return RMW_RET_ERROR; + return RMW_RET_OK; } rmw_ret_t rmw_fini_publisher_allocation(rmw_publisher_allocation_t * allocation) { + // Unused in current implementation. (void) allocation; - RMW_SET_ERROR_MSG("not implemented."); - return RMW_RET_ERROR; + return RMW_RET_OK; } rmw_publisher_t * diff --git a/rmw_fastrtps_cpp/src/rmw_subscription.cpp b/rmw_fastrtps_cpp/src/rmw_subscription.cpp index 6bd552b09..a51fa5826 100644 --- a/rmw_fastrtps_cpp/src/rmw_subscription.cpp +++ b/rmw_fastrtps_cpp/src/rmw_subscription.cpp @@ -40,23 +40,24 @@ extern "C" { rmw_ret_t rmw_init_subscription_allocation( - const rosidl_message_type_support_t * type_supports, + const rosidl_message_type_support_t * type_support, const rosidl_message_bounds_t * message_bounds, rmw_subscription_allocation_t * allocation) { - (void) type_supports; + (void) type_support; (void) message_bounds; - (void) allocation; - RMW_SET_ERROR_MSG("not implemented."); - return RMW_RET_ERROR; + // Since this feature is currently not implemented in FastRTPS, set the + // allocation pointer to NULL. The downstream `rmw_take` methods will + // ignore the value. + allocation = nullptr; + return RMW_RET_OK; } rmw_ret_t rmw_fini_subscription_allocation(rmw_subscription_allocation_t * allocation) { (void) allocation; - RMW_SET_ERROR_MSG("not implemented."); - return RMW_RET_ERROR; + return RMW_RET_OK; } rmw_subscription_t * diff --git a/rmw_fastrtps_cpp/src/rmw_take.cpp b/rmw_fastrtps_cpp/src/rmw_take.cpp index 483a74f3e..313f5115e 100644 --- a/rmw_fastrtps_cpp/src/rmw_take.cpp +++ b/rmw_fastrtps_cpp/src/rmw_take.cpp @@ -52,10 +52,11 @@ rmw_ret_t rmw_take_serialized_message( const rmw_subscription_t * subscription, rmw_serialized_message_t * serialized_message, - bool * taken) + bool * taken, + rmw_subscription_allocation_t * allocation) { return rmw_fastrtps_shared_cpp::__rmw_take_serialized_message( - eprosima_fastrtps_identifier, subscription, serialized_message, taken); + eprosima_fastrtps_identifier, subscription, serialized_message, taken, allocation); } rmw_ret_t @@ -63,9 +64,11 @@ rmw_take_serialized_message_with_info( const rmw_subscription_t * subscription, rmw_serialized_message_t * serialized_message, bool * taken, - rmw_message_info_t * message_info) + rmw_message_info_t * message_info, + rmw_subscription_allocation_t * allocation) { return rmw_fastrtps_shared_cpp::__rmw_take_serialized_message_with_info( - eprosima_fastrtps_identifier, subscription, serialized_message, taken, message_info); + eprosima_fastrtps_identifier, subscription, serialized_message, taken, message_info, + allocation); } } // extern "C" diff --git a/rmw_fastrtps_dynamic_cpp/src/rmw_publish.cpp b/rmw_fastrtps_dynamic_cpp/src/rmw_publish.cpp index d6817fbc1..a6e9c038d 100644 --- a/rmw_fastrtps_dynamic_cpp/src/rmw_publish.cpp +++ b/rmw_fastrtps_dynamic_cpp/src/rmw_publish.cpp @@ -37,9 +37,11 @@ rmw_publish( rmw_ret_t rmw_publish_serialized_message( - const rmw_publisher_t * publisher, const rmw_serialized_message_t * serialized_message) + const rmw_publisher_t * publisher, + const rmw_serialized_message_t * serialized_message, + rmw_publisher_allocation_t * allocation) { return rmw_fastrtps_shared_cpp::__rmw_publish_serialized_message( - eprosima_fastrtps_identifier, publisher, serialized_message); + eprosima_fastrtps_identifier, publisher, serialized_message, allocation); } } // extern "C" diff --git a/rmw_fastrtps_dynamic_cpp/src/rmw_publisher.cpp b/rmw_fastrtps_dynamic_cpp/src/rmw_publisher.cpp index 7f9eb6379..20d4621d5 100644 --- a/rmw_fastrtps_dynamic_cpp/src/rmw_publisher.cpp +++ b/rmw_fastrtps_dynamic_cpp/src/rmw_publisher.cpp @@ -35,23 +35,23 @@ extern "C" { rmw_ret_t rmw_init_publisher_allocation( - const rosidl_message_type_support_t * type_supports, + const rosidl_message_type_support_t * type_support, const rosidl_message_bounds_t * message_bounds, rmw_publisher_allocation_t * allocation) { - (void) type_supports; + // Unused in current implementation. + (void) type_support; (void) message_bounds; (void) allocation; - RMW_SET_ERROR_MSG("not implemented."); - return RMW_RET_ERROR; + return RMW_RET_OK; } rmw_ret_t rmw_fini_publisher_allocation(rmw_publisher_allocation_t * allocation) { + // Unused in current implementation. (void) allocation; - RMW_SET_ERROR_MSG("not implemented."); - return RMW_RET_ERROR; + return RMW_RET_OK; } rmw_publisher_t * diff --git a/rmw_fastrtps_dynamic_cpp/src/rmw_subscription.cpp b/rmw_fastrtps_dynamic_cpp/src/rmw_subscription.cpp index 7f01e7e61..d7b23ef12 100644 --- a/rmw_fastrtps_dynamic_cpp/src/rmw_subscription.cpp +++ b/rmw_fastrtps_dynamic_cpp/src/rmw_subscription.cpp @@ -40,23 +40,23 @@ extern "C" { rmw_ret_t rmw_init_subscription_allocation( - const rosidl_message_type_support_t * type_supports, + const rosidl_message_type_support_t * type_support, const rosidl_message_bounds_t * message_bounds, rmw_subscription_allocation_t * allocation) { - (void) type_supports; + // Unused in current implementation. + (void) type_support; (void) message_bounds; (void) allocation; - RMW_SET_ERROR_MSG("not implemented."); - return RMW_RET_ERROR; + return RMW_RET_OK; } rmw_ret_t rmw_fini_subscription_allocation(rmw_subscription_allocation_t * allocation) { + // Unused in current implementation. (void) allocation; - RMW_SET_ERROR_MSG("not implemented."); - return RMW_RET_ERROR; + return RMW_RET_OK; } rmw_subscription_t * diff --git a/rmw_fastrtps_dynamic_cpp/src/rmw_take.cpp b/rmw_fastrtps_dynamic_cpp/src/rmw_take.cpp index 70ec9c69e..9c2ea1533 100644 --- a/rmw_fastrtps_dynamic_cpp/src/rmw_take.cpp +++ b/rmw_fastrtps_dynamic_cpp/src/rmw_take.cpp @@ -50,10 +50,11 @@ rmw_ret_t rmw_take_serialized_message( const rmw_subscription_t * subscription, rmw_serialized_message_t * serialized_message, - bool * taken) + bool * taken, + rmw_subscription_allocation_t * allocation) { return rmw_fastrtps_shared_cpp::__rmw_take_serialized_message( - eprosima_fastrtps_identifier, subscription, serialized_message, taken); + eprosima_fastrtps_identifier, subscription, serialized_message, taken, allocation); } rmw_ret_t @@ -61,9 +62,11 @@ rmw_take_serialized_message_with_info( const rmw_subscription_t * subscription, rmw_serialized_message_t * serialized_message, bool * taken, - rmw_message_info_t * message_info) + rmw_message_info_t * message_info, + rmw_subscription_allocation_t * allocation) { return rmw_fastrtps_shared_cpp::__rmw_take_serialized_message_with_info( - eprosima_fastrtps_identifier, subscription, serialized_message, taken, message_info); + eprosima_fastrtps_identifier, subscription, serialized_message, taken, message_info, + allocation); } } // extern "C" diff --git a/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/rmw_common.hpp b/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/rmw_common.hpp index de22ed597..ee38c769b 100644 --- a/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/rmw_common.hpp +++ b/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/rmw_common.hpp @@ -121,7 +121,8 @@ rmw_ret_t __rmw_publish_serialized_message( const char * identifier, const rmw_publisher_t * publisher, - const rmw_serialized_message_t * serialized_message); + const rmw_serialized_message_t * serialized_message, + rmw_publisher_allocation_t * allocation); RMW_FASTRTPS_SHARED_CPP_PUBLIC rmw_ret_t @@ -269,7 +270,8 @@ __rmw_take_serialized_message( const char * identifier, const rmw_subscription_t * subscription, rmw_serialized_message_t * serialized_message, - bool * taken); + bool * taken, + rmw_subscription_allocation_t * allocation); RMW_FASTRTPS_SHARED_CPP_PUBLIC rmw_ret_t @@ -278,7 +280,8 @@ __rmw_take_serialized_message_with_info( const rmw_subscription_t * subscription, rmw_serialized_message_t * serialized_message, bool * taken, - rmw_message_info_t * message_info); + rmw_message_info_t * message_info, + rmw_subscription_allocation_t * allocation); RMW_FASTRTPS_SHARED_CPP_PUBLIC rmw_ret_t diff --git a/rmw_fastrtps_shared_cpp/src/rmw_publish.cpp b/rmw_fastrtps_shared_cpp/src/rmw_publish.cpp index 16054881c..443d1f4d9 100644 --- a/rmw_fastrtps_shared_cpp/src/rmw_publish.cpp +++ b/rmw_fastrtps_shared_cpp/src/rmw_publish.cpp @@ -60,8 +60,10 @@ rmw_ret_t __rmw_publish_serialized_message( const char * identifier, const rmw_publisher_t * publisher, - const rmw_serialized_message_t * serialized_message) + const rmw_serialized_message_t * serialized_message, + rmw_publisher_allocation_t * allocation) { + (void) allocation; RCUTILS_CHECK_FOR_NULL_WITH_MSG(publisher, "publisher pointer is null", return RMW_RET_ERROR); RCUTILS_CHECK_FOR_NULL_WITH_MSG( serialized_message, "serialized_message pointer is null", return RMW_RET_ERROR); diff --git a/rmw_fastrtps_shared_cpp/src/rmw_take.cpp b/rmw_fastrtps_shared_cpp/src/rmw_take.cpp index 432eb8bf7..fbdfdbf38 100644 --- a/rmw_fastrtps_shared_cpp/src/rmw_take.cpp +++ b/rmw_fastrtps_shared_cpp/src/rmw_take.cpp @@ -125,8 +125,10 @@ _take_serialized_message( const rmw_subscription_t * subscription, rmw_serialized_message_t * serialized_message, bool * taken, - rmw_message_info_t * message_info) + rmw_message_info_t * message_info, + rmw_subscription_allocation_t * allocation) { + (void) allocation; *taken = false; if (subscription->implementation_identifier != identifier) { @@ -172,7 +174,8 @@ __rmw_take_serialized_message( const char * identifier, const rmw_subscription_t * subscription, rmw_serialized_message_t * serialized_message, - bool * taken) + bool * taken, + rmw_subscription_allocation_t * allocation) { RCUTILS_CHECK_FOR_NULL_WITH_MSG( subscription, "subscription pointer is null", return RMW_RET_ERROR); @@ -180,7 +183,8 @@ __rmw_take_serialized_message( serialized_message, "ros_message pointer is null", return RMW_RET_ERROR); RCUTILS_CHECK_FOR_NULL_WITH_MSG(taken, "boolean flag for taken is null", return RMW_RET_ERROR); - return _take_serialized_message(identifier, subscription, serialized_message, taken, nullptr); + return _take_serialized_message(identifier, subscription, serialized_message, taken, nullptr, + allocation); } rmw_ret_t @@ -189,7 +193,8 @@ __rmw_take_serialized_message_with_info( const rmw_subscription_t * subscription, rmw_serialized_message_t * serialized_message, bool * taken, - rmw_message_info_t * message_info) + rmw_message_info_t * message_info, + rmw_subscription_allocation_t * allocation) { RCUTILS_CHECK_FOR_NULL_WITH_MSG( subscription, "subscription pointer is null", return RMW_RET_ERROR); @@ -200,6 +205,6 @@ __rmw_take_serialized_message_with_info( message_info, "message info pointer is null", return RMW_RET_ERROR); return _take_serialized_message( - identifier, subscription, serialized_message, taken, message_info); + identifier, subscription, serialized_message, taken, message_info, allocation); } } // namespace rmw_fastrtps_shared_cpp From e3e26255ddb7d0bd8b63cc4dfe84af02dcf3440f Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Wed, 1 May 2019 13:31:54 -0500 Subject: [PATCH 3/4] Stub for serialized message size. Signed-off-by: Michael Carroll --- rmw_fastrtps_cpp/src/rmw_serialize.cpp | 10 ++++++++++ rmw_fastrtps_cpp/src/rmw_subscription.cpp | 5 +---- rmw_fastrtps_dynamic_cpp/src/rmw_serialize.cpp | 10 ++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/rmw_fastrtps_cpp/src/rmw_serialize.cpp b/rmw_fastrtps_cpp/src/rmw_serialize.cpp index 4dc5645ac..dd954efcc 100644 --- a/rmw_fastrtps_cpp/src/rmw_serialize.cpp +++ b/rmw_fastrtps_cpp/src/rmw_serialize.cpp @@ -89,4 +89,14 @@ rmw_deserialize( delete tss; return ret == true ? RMW_RET_OK : RMW_RET_ERROR; } + +rmw_ret_t +rmw_get_serialized_message_size( + const rosidl_message_type_support_t * /*type_support*/, + const rosidl_message_bounds_t * /*message_bounds*/, + size_t * /*size*/) +{ + RMW_SET_ERROR_MSG("unimplemented"); + return RMW_RET_ERROR; +} } // extern "C" diff --git a/rmw_fastrtps_cpp/src/rmw_subscription.cpp b/rmw_fastrtps_cpp/src/rmw_subscription.cpp index a51fa5826..395c17448 100644 --- a/rmw_fastrtps_cpp/src/rmw_subscription.cpp +++ b/rmw_fastrtps_cpp/src/rmw_subscription.cpp @@ -46,10 +46,7 @@ rmw_init_subscription_allocation( { (void) type_support; (void) message_bounds; - // Since this feature is currently not implemented in FastRTPS, set the - // allocation pointer to NULL. The downstream `rmw_take` methods will - // ignore the value. - allocation = nullptr; + (void) allocation; return RMW_RET_OK; } diff --git a/rmw_fastrtps_dynamic_cpp/src/rmw_serialize.cpp b/rmw_fastrtps_dynamic_cpp/src/rmw_serialize.cpp index 64efe0910..5e67c73a9 100644 --- a/rmw_fastrtps_dynamic_cpp/src/rmw_serialize.cpp +++ b/rmw_fastrtps_dynamic_cpp/src/rmw_serialize.cpp @@ -88,4 +88,14 @@ rmw_deserialize( delete tss; return ret == true ? RMW_RET_OK : RMW_RET_ERROR; } + +rmw_ret_t +rmw_get_serialized_message_size( + const rosidl_message_type_support_t * /*type_support*/, + const rosidl_message_bounds_t * /*message_bounds*/, + size_t * /*size*/) +{ + RMW_SET_ERROR_MSG("unimplemented"); + return RMW_RET_ERROR; +} } // extern "C" From e0ea3cee16b27eb0c2be013b04aaefcdb1bf0169 Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Wed, 1 May 2019 17:10:13 -0500 Subject: [PATCH 4/4] Address reviewer feedback. Signed-off-by: Michael Carroll --- rmw_fastrtps_cpp/src/rmw_publish.cpp | 1 - rmw_fastrtps_cpp/src/rmw_publisher.cpp | 6 ++++-- rmw_fastrtps_cpp/src/rmw_subscription.cpp | 8 ++++++-- rmw_fastrtps_cpp/src/rmw_take.cpp | 2 -- rmw_fastrtps_dynamic_cpp/src/rmw_publisher.cpp | 6 ++++-- rmw_fastrtps_dynamic_cpp/src/rmw_subscription.cpp | 6 ++++-- 6 files changed, 18 insertions(+), 11 deletions(-) diff --git a/rmw_fastrtps_cpp/src/rmw_publish.cpp b/rmw_fastrtps_cpp/src/rmw_publish.cpp index 966eb1ac1..006197397 100644 --- a/rmw_fastrtps_cpp/src/rmw_publish.cpp +++ b/rmw_fastrtps_cpp/src/rmw_publish.cpp @@ -31,7 +31,6 @@ rmw_publish( const void * ros_message, rmw_publisher_allocation_t * allocation) { - (void) allocation; return rmw_fastrtps_shared_cpp::__rmw_publish( eprosima_fastrtps_identifier, publisher, ros_message, allocation); } diff --git a/rmw_fastrtps_cpp/src/rmw_publisher.cpp b/rmw_fastrtps_cpp/src/rmw_publisher.cpp index 6fb15ac1c..873301f01 100644 --- a/rmw_fastrtps_cpp/src/rmw_publisher.cpp +++ b/rmw_fastrtps_cpp/src/rmw_publisher.cpp @@ -44,7 +44,8 @@ rmw_init_publisher_allocation( (void) type_support; (void) message_bounds; (void) allocation; - return RMW_RET_OK; + RMW_SET_ERROR_MSG("unimplemented"); + return RMW_RET_ERROR; } rmw_ret_t @@ -52,7 +53,8 @@ rmw_fini_publisher_allocation(rmw_publisher_allocation_t * allocation) { // Unused in current implementation. (void) allocation; - return RMW_RET_OK; + RMW_SET_ERROR_MSG("unimplemented"); + return RMW_RET_ERROR; } rmw_publisher_t * diff --git a/rmw_fastrtps_cpp/src/rmw_subscription.cpp b/rmw_fastrtps_cpp/src/rmw_subscription.cpp index 395c17448..4d92c958f 100644 --- a/rmw_fastrtps_cpp/src/rmw_subscription.cpp +++ b/rmw_fastrtps_cpp/src/rmw_subscription.cpp @@ -44,17 +44,21 @@ rmw_init_subscription_allocation( const rosidl_message_bounds_t * message_bounds, rmw_subscription_allocation_t * allocation) { + // Unused in current implementation. (void) type_support; (void) message_bounds; (void) allocation; - return RMW_RET_OK; + RMW_SET_ERROR_MSG("unimplemented"); + return RMW_RET_ERROR; } rmw_ret_t rmw_fini_subscription_allocation(rmw_subscription_allocation_t * allocation) { + // Unused in current implementation. (void) allocation; - return RMW_RET_OK; + RMW_SET_ERROR_MSG("unimplemented"); + return RMW_RET_ERROR; } rmw_subscription_t * diff --git a/rmw_fastrtps_cpp/src/rmw_take.cpp b/rmw_fastrtps_cpp/src/rmw_take.cpp index 313f5115e..228df03e8 100644 --- a/rmw_fastrtps_cpp/src/rmw_take.cpp +++ b/rmw_fastrtps_cpp/src/rmw_take.cpp @@ -30,7 +30,6 @@ rmw_take( bool * taken, rmw_subscription_allocation_t * allocation) { - (void) allocation; return rmw_fastrtps_shared_cpp::__rmw_take( eprosima_fastrtps_identifier, subscription, ros_message, taken, allocation); } @@ -43,7 +42,6 @@ rmw_take_with_info( rmw_message_info_t * message_info, rmw_subscription_allocation_t * allocation) { - (void) allocation; return rmw_fastrtps_shared_cpp::__rmw_take_with_info( eprosima_fastrtps_identifier, subscription, ros_message, taken, message_info, allocation); } diff --git a/rmw_fastrtps_dynamic_cpp/src/rmw_publisher.cpp b/rmw_fastrtps_dynamic_cpp/src/rmw_publisher.cpp index 20d4621d5..5eb9f967a 100644 --- a/rmw_fastrtps_dynamic_cpp/src/rmw_publisher.cpp +++ b/rmw_fastrtps_dynamic_cpp/src/rmw_publisher.cpp @@ -43,7 +43,8 @@ rmw_init_publisher_allocation( (void) type_support; (void) message_bounds; (void) allocation; - return RMW_RET_OK; + RMW_SET_ERROR_MSG("unimplemented"); + return RMW_RET_ERROR; } rmw_ret_t @@ -51,7 +52,8 @@ rmw_fini_publisher_allocation(rmw_publisher_allocation_t * allocation) { // Unused in current implementation. (void) allocation; - return RMW_RET_OK; + RMW_SET_ERROR_MSG("unimplemented"); + return RMW_RET_ERROR; } rmw_publisher_t * diff --git a/rmw_fastrtps_dynamic_cpp/src/rmw_subscription.cpp b/rmw_fastrtps_dynamic_cpp/src/rmw_subscription.cpp index d7b23ef12..08e3c3e90 100644 --- a/rmw_fastrtps_dynamic_cpp/src/rmw_subscription.cpp +++ b/rmw_fastrtps_dynamic_cpp/src/rmw_subscription.cpp @@ -48,7 +48,8 @@ rmw_init_subscription_allocation( (void) type_support; (void) message_bounds; (void) allocation; - return RMW_RET_OK; + RMW_SET_ERROR_MSG("unimplemented"); + return RMW_RET_ERROR; } rmw_ret_t @@ -56,7 +57,8 @@ rmw_fini_subscription_allocation(rmw_subscription_allocation_t * allocation) { // Unused in current implementation. (void) allocation; - return RMW_RET_OK; + RMW_SET_ERROR_MSG("unimplemented"); + return RMW_RET_ERROR; } rmw_subscription_t *