Skip to content

Commit

Permalink
Move rmw_*_event_init() functions to rmw_implementation (#202)
Browse files Browse the repository at this point in the history
Signed-off-by: Miaofei <miaofei@amazon.com>
  • Loading branch information
mm318 authored Mar 19, 2020
1 parent 71b000c commit f765113
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 48 deletions.
6 changes: 4 additions & 2 deletions rmw/include/rmw/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ rmw_get_zero_initialized_event(void);
* \param publisher to initialize with
* \param event_type for the event to handle
* \return `RMW_RET_OK` if successful, or
* \return `RMW_RET_INVALID_ARGUMENT` if invalid argument
* \return `RMW_RET_INVALID_ARGUMENT` if invalid argument, or
* \return `RMW_RET_UNSUPPORTED` if event_type is not supported, or
* \return `RMW_RET_ERROR` if an unexpected error occurs.
*/
RMW_PUBLIC
Expand All @@ -84,7 +85,8 @@ rmw_publisher_event_init(
* \param subscription to initialize with
* \param event_type for the event to handle
* \return `RMW_RET_OK` if successful, or
* \return `RMW_RET_INVALID_ARGUMENT` if invalid argument
* \return `RMW_RET_INVALID_ARGUMENT` if invalid argument, or
* \return `RMW_RET_UNSUPPORTED` if event_type is not supported, or
* \return `RMW_RET_ERROR` if an unexpected error occurs.
*/
RMW_PUBLIC
Expand Down
46 changes: 0 additions & 46 deletions rmw/src/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,52 +32,6 @@ rmw_get_zero_initialized_event(void)
return event;
}

rmw_ret_t
__rmw_init_event(
rmw_event_t * rmw_event,
const char * implementation_identifier,
void * data,
const rmw_event_type_t event_type)
{
RMW_CHECK_ARGUMENT_FOR_NULL(implementation_identifier, RMW_RET_INVALID_ARGUMENT);
RMW_CHECK_ARGUMENT_FOR_NULL(data, RMW_RET_INVALID_ARGUMENT);
RMW_CHECK_ARGUMENT_FOR_NULL(rmw_event, RMW_RET_INVALID_ARGUMENT);
if (NULL != rmw_event->implementation_identifier) {
RMW_SET_ERROR_MSG("expected zero-initialized rmw_event");
return RMW_RET_INVALID_ARGUMENT;
}
rmw_event->implementation_identifier = implementation_identifier;
rmw_event->data = data;
rmw_event->event_type = event_type;
return RMW_RET_OK;
}

rmw_ret_t
rmw_publisher_event_init(
rmw_event_t * rmw_event,
const rmw_publisher_t * publisher,
rmw_event_type_t event_type)
{
return __rmw_init_event(
rmw_event,
publisher->implementation_identifier,
publisher->data,
event_type);
}

rmw_ret_t
rmw_subscription_event_init(
rmw_event_t * rmw_event,
const rmw_subscription_t * subscription,
rmw_event_type_t event_type)
{
return __rmw_init_event(
rmw_event,
subscription->implementation_identifier,
subscription->data,
event_type);
}

rmw_ret_t
rmw_event_fini(rmw_event_t * rmw_event)
{
Expand Down

0 comments on commit f765113

Please sign in to comment.