Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Stub out new allocation APIs. #353

Merged
merged 3 commits into from
May 2, 2019
Merged
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
11 changes: 9 additions & 2 deletions rmw_connext_cpp/src/rmw_publish.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,12 @@ publish(DDS::DataWriter * dds_data_writer, const rcutils_uint8_array_t * cdr_str
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;
if (!publisher) {
RMW_SET_ERROR_MSG("publisher handle is null");
return RMW_RET_ERROR;
Expand Down Expand Up @@ -137,8 +141,11 @@ rmw_publish(const rmw_publisher_t * publisher, const void * ros_message)

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)
{
(void) allocation;
if (!publisher) {
RMW_SET_ERROR_MSG("publisher handle is null");
return RMW_RET_ERROR;
Expand Down
23 changes: 23 additions & 0 deletions rmw_connext_cpp/src/rmw_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,29 @@

extern "C"
{
rmw_ret_t
rmw_init_publisher_allocation(
const rosidl_message_type_support_t * type_support,
const rosidl_message_bounds_t * message_bounds,
rmw_publisher_allocation_t * allocation)
{
// Unused in current implementation.
Copy link
Contributor

Choose a reason for hiding this comment

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

As with the other rmw implementations, I think we should probably return an error here and below.

(void) type_support;
(void) message_bounds;
(void) allocation;
RMW_SET_ERROR_MSG("unimplemented");
return RMW_RET_ERROR;
}

rmw_ret_t
rmw_fini_publisher_allocation(rmw_publisher_allocation_t * allocation)
{
// Unused in current implementation.
(void) allocation;
RMW_SET_ERROR_MSG("unimplemented");
return RMW_RET_ERROR;
}

rmw_publisher_t *
rmw_create_publisher(
const rmw_node_t * node,
Expand Down
23 changes: 23 additions & 0 deletions rmw_connext_cpp/src/rmw_subscription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,29 @@

extern "C"
{
rmw_ret_t
rmw_init_subscription_allocation(
const rosidl_message_type_support_t * type_support,
const rosidl_message_bounds_t * message_bounds,
rmw_subscription_allocation_t * allocation)
{
// Unused in current implementation.
(void) type_support;
(void) message_bounds;
(void) allocation;
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;
RMW_SET_ERROR_MSG("unimplemented");
return RMW_RET_ERROR;
}

rmw_subscription_t *
rmw_create_subscription(
const rmw_node_t * node,
Expand Down
38 changes: 25 additions & 13 deletions rmw_connext_cpp/src/rmw_take.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ take(
bool ignore_local_publications,
rcutils_uint8_array_t * cdr_stream,
bool * taken,
void * sending_publication_handle)
void * sending_publication_handle,
rmw_subscription_allocation_t * allocation)
{
(void) allocation;
if (!dds_data_reader) {
RMW_SET_ERROR_MSG("dds_data_reader is null");
return false;
Expand Down Expand Up @@ -134,7 +136,8 @@ _take(
const rmw_subscription_t * subscription,
void * ros_message,
bool * taken,
DDS::InstanceHandle_t * sending_publication_handle)
DDS::InstanceHandle_t * sending_publication_handle,
rmw_subscription_allocation_t * allocation)
{
if (!subscription) {
RMW_SET_ERROR_MSG("subscription handle is null");
Expand Down Expand Up @@ -175,7 +178,7 @@ _take(
rcutils_uint8_array_t cdr_stream = rcutils_get_zero_initialized_uint8_array();
if (!take(
topic_reader, subscriber_info->ignore_local_publications, &cdr_stream, taken,
sending_publication_handle))
sending_publication_handle, allocation))
{
RMW_SET_ERROR_MSG("error occured while taking message");
return RMW_RET_ERROR;
Expand All @@ -194,24 +197,29 @@ _take(
}

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 _take(subscription, ros_message, taken, nullptr);
return _take(subscription, ros_message, taken, nullptr, allocation);
}

rmw_ret_t
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)
{
if (!message_info) {
RMW_SET_ERROR_MSG("message info is null");
return RMW_RET_ERROR;
}
DDS::InstanceHandle_t sending_publication_handle;
auto ret = _take(subscription, ros_message, taken, &sending_publication_handle);
auto ret = _take(subscription, ros_message, taken, &sending_publication_handle, allocation);
if (ret != RMW_RET_OK) {
// Error string is already set.
return RMW_RET_ERROR;
Expand All @@ -231,7 +239,8 @@ _take_serialized_message(
const rmw_subscription_t * subscription,
rmw_serialized_message_t * serialized_message,
bool * taken,
DDS::InstanceHandle_t * sending_publication_handle)
DDS::InstanceHandle_t * sending_publication_handle,
rmw_subscription_allocation_t * allocation)
{
if (!subscription) {
RMW_SET_ERROR_MSG("subscription handle is null");
Expand Down Expand Up @@ -271,7 +280,7 @@ _take_serialized_message(
// fetch the incoming message as cdr stream
if (!take(
topic_reader, subscriber_info->ignore_local_publications, serialized_message, taken,
sending_publication_handle))
sending_publication_handle, allocation))
{
RMW_SET_ERROR_MSG("error occured while taking message");
return RMW_RET_ERROR;
Expand All @@ -284,25 +293,28 @@ 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 _take_serialized_message(subscription, serialized_message, taken, nullptr);
return _take_serialized_message(subscription, serialized_message, taken, nullptr, allocation);
}

rmw_ret_t
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)
{
if (!message_info) {
RMW_SET_ERROR_MSG("message info is null");
return RMW_RET_ERROR;
}
DDS::InstanceHandle_t sending_publication_handle;
auto ret =
_take_serialized_message(subscription, serialized_message, taken, &sending_publication_handle);
_take_serialized_message(subscription, serialized_message, taken,
&sending_publication_handle, allocation);
if (ret != RMW_RET_OK) {
// Error string is already set.
return RMW_RET_ERROR;
Expand Down