Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move rmw_*_event_init() functions to rmw_implementation #202

Merged
merged 2 commits into from
Mar 19, 2020
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
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