From f76511333709a6f5d1e4543129ec73f2cd2b4f06 Mon Sep 17 00:00:00 2001 From: Miaofei Mei Date: Thu, 19 Mar 2020 13:13:51 -0700 Subject: [PATCH] Move rmw_*_event_init() functions to rmw_implementation (#202) Signed-off-by: Miaofei --- rmw/include/rmw/event.h | 6 ++++-- rmw/src/event.c | 46 ----------------------------------------- 2 files changed, 4 insertions(+), 48 deletions(-) diff --git a/rmw/include/rmw/event.h b/rmw/include/rmw/event.h index e24cd5df..bf4917aa 100644 --- a/rmw/include/rmw/event.h +++ b/rmw/include/rmw/event.h @@ -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 @@ -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 diff --git a/rmw/src/event.c b/rmw/src/event.c index c4b3dc0a..8005fe47 100644 --- a/rmw/src/event.c +++ b/rmw/src/event.c @@ -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) {