Skip to content

Commit

Permalink
Merge pull request #5 from ros2/master
Browse files Browse the repository at this point in the history
Updates for preallocation API. (#274)
  • Loading branch information
AAlon authored May 2, 2019
2 parents 3ad33d6 + b27c4a5 commit 6410261
Show file tree
Hide file tree
Showing 13 changed files with 199 additions and 42 deletions.
13 changes: 9 additions & 4 deletions rmw_fastrtps_cpp/src/rmw_publish.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,22 @@
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
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"
23 changes: 23 additions & 0 deletions rmw_fastrtps_cpp/src/rmw_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,29 @@ using TopicDataType = eprosima::fastrtps::TopicDataType;

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.
(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
10 changes: 10 additions & 0 deletions rmw_fastrtps_cpp/src/rmw_serialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
23 changes: 23 additions & 0 deletions rmw_fastrtps_cpp/src/rmw_subscription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,29 @@ using TopicDataType = eprosima::fastrtps::TopicDataType;

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
24 changes: 16 additions & 8 deletions rmw_fastrtps_cpp/src/rmw_take.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,41 +24,49 @@
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
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
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
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"
13 changes: 9 additions & 4 deletions rmw_fastrtps_dynamic_cpp/src/rmw_publish.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,22 @@
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
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"
23 changes: 23 additions & 0 deletions rmw_fastrtps_dynamic_cpp/src/rmw_publisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,29 @@ using TopicDataType = eprosima::fastrtps::TopicDataType;

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.
(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
10 changes: 10 additions & 0 deletions rmw_fastrtps_dynamic_cpp/src/rmw_serialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
23 changes: 23 additions & 0 deletions rmw_fastrtps_dynamic_cpp/src/rmw_subscription.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,29 @@ using TopicDataType = eprosima::fastrtps::TopicDataType;

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
24 changes: 16 additions & 8 deletions rmw_fastrtps_dynamic_cpp/src/rmw_take.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,41 +24,49 @@
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
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
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
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"
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,16 @@ 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
__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
Expand Down Expand Up @@ -249,7 +251,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
Expand All @@ -258,15 +261,17 @@ __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
__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
Expand All @@ -275,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
Expand Down
Loading

0 comments on commit 6410261

Please sign in to comment.