From 3d033ed1ca92cee53e5bcc6b0d89e5fbe36fd40b Mon Sep 17 00:00:00 2001 From: Karsten Knese Date: Fri, 18 Oct 2019 14:50:08 -0700 Subject: [PATCH] zero copy api for opensplice (#285) * zero copy api for opensplice Signed-off-by: Karsten Knese * use RMW_RET_UNSUPPORTED Signed-off-by: Karsten Knese --- rmw_opensplice_cpp/src/rmw_publish.cpp | 14 +++++++ rmw_opensplice_cpp/src/rmw_publisher.cpp | 27 ++++++++++++ rmw_opensplice_cpp/src/rmw_subscription.cpp | 1 + rmw_opensplice_cpp/src/rmw_take.cpp | 46 +++++++++++++++++++++ 4 files changed, 88 insertions(+) diff --git a/rmw_opensplice_cpp/src/rmw_publish.cpp b/rmw_opensplice_cpp/src/rmw_publish.cpp index aa7085a6..b03c3225 100644 --- a/rmw_opensplice_cpp/src/rmw_publish.cpp +++ b/rmw_opensplice_cpp/src/rmw_publish.cpp @@ -166,4 +166,18 @@ rmw_publish_serialized_message( return RMW_RET_OK; } + +rmw_ret_t +rmw_publish_loaned_message( + const rmw_publisher_t * publisher, + void * ros_message, + rmw_publisher_allocation_t * allocation) +{ + (void) publisher; + (void) ros_message; + (void) allocation; + + RMW_SET_ERROR_MSG("rmw_publish_loaned_message not implemented for rmw_opensplice_cpp"); + return RMW_RET_UNSUPPORTED; +} } // extern "C" diff --git a/rmw_opensplice_cpp/src/rmw_publisher.cpp b/rmw_opensplice_cpp/src/rmw_publisher.cpp index d298aeaf..4d6a95d9 100644 --- a/rmw_opensplice_cpp/src/rmw_publisher.cpp +++ b/rmw_opensplice_cpp/src/rmw_publisher.cpp @@ -252,6 +252,7 @@ rmw_create_publisher( memcpy(const_cast(publisher->topic_name), topic_name, strlen(topic_name) + 1); publisher->options = *publisher_options; + publisher->can_loan_messages = false; return publisher; fail: if (publisher) { @@ -378,6 +379,32 @@ rmw_publisher_assert_liveliness(const rmw_publisher_t * publisher) return result; } +rmw_ret_t +rmw_borrow_loaned_message( + const rmw_publisher_t * publisher, + const rosidl_message_type_support_t * type_support, + void ** ros_message) +{ + (void) publisher; + (void) type_support; + (void) ros_message; + + RMW_SET_ERROR_MSG("rmw_borrow_loaned_message not implemented for rmw_opensplice_cpp"); + return RMW_RET_UNSUPPORTED; +} + +rmw_ret_t +rmw_return_loaned_message( + const rmw_publisher_t * publisher, + void * loaned_message) +{ + (void) publisher; + (void) loaned_message; + + RMW_SET_ERROR_MSG("rmw_return_loaned_message not implemented for rmw_opensplice_cpp"); + return RMW_RET_UNSUPPORTED; +} + rmw_ret_t rmw_destroy_publisher(rmw_node_t * node, rmw_publisher_t * publisher) { diff --git a/rmw_opensplice_cpp/src/rmw_subscription.cpp b/rmw_opensplice_cpp/src/rmw_subscription.cpp index c3dd37b5..61702cca 100644 --- a/rmw_opensplice_cpp/src/rmw_subscription.cpp +++ b/rmw_opensplice_cpp/src/rmw_subscription.cpp @@ -249,6 +249,7 @@ rmw_create_subscription( memcpy(const_cast(subscription->topic_name), topic_name, strlen(topic_name) + 1); subscription->options = *subscription_options; + subscription->can_loan_messages = false; return subscription; fail: if (dds_subscriber) { diff --git a/rmw_opensplice_cpp/src/rmw_take.cpp b/rmw_opensplice_cpp/src/rmw_take.cpp index 4143eb4f..8c49be29 100644 --- a/rmw_opensplice_cpp/src/rmw_take.cpp +++ b/rmw_opensplice_cpp/src/rmw_take.cpp @@ -321,4 +321,50 @@ rmw_take_serialized_message_with_info( return RMW_RET_OK; } + +rmw_ret_t +rmw_take_loaned_message( + const rmw_subscription_t * subscription, + void ** loaned_message, + bool * taken, + rmw_subscription_allocation_t * allocation) +{ + (void) subscription; + (void) loaned_message; + (void) taken; + (void) allocation; + + RMW_SET_ERROR_MSG("rmw_take_loaned_message not implemented for rmw_opensplice_cpp"); + return RMW_RET_UNSUPPORTED; +} + +rmw_ret_t +rmw_take_loaned_message_with_info( + const rmw_subscription_t * subscription, + void ** loaned_message, + bool * taken, + rmw_message_info_t * message_info, + rmw_subscription_allocation_t * allocation) +{ + (void) subscription; + (void) loaned_message; + (void) taken; + (void) message_info; + (void) allocation; + + RMW_SET_ERROR_MSG("rmw_take_loaned_message_with_info not implemented for rmw_opensplice_cpp"); + return RMW_RET_UNSUPPORTED; +} + +rmw_ret_t +rmw_release_loaned_message( + const rmw_subscription_t * subscription, + void * loaned_message) +{ + (void) subscription; + (void) loaned_message; + + RMW_SET_ERROR_MSG("rmw_release_loaned_message not implemented for rmw_opensplice_cpp"); + return RMW_RET_UNSUPPORTED; +} } // extern "C"