From d388d7d664f6fb9c6ab8a6dbf757d723da4d2254 Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Thu, 2 Jun 2022 15:41:55 +0200 Subject: [PATCH] Allow null arguments in the EventsExecutor parameters (#605) Signed-off-by: Jose Luis Rivero --- rmw_fastrtps_cpp/src/rmw_client.cpp | 2 ++ rmw_fastrtps_cpp/src/rmw_event.cpp | 2 ++ rmw_fastrtps_cpp/src/rmw_service.cpp | 2 ++ rmw_fastrtps_cpp/src/rmw_subscription.cpp | 2 ++ rmw_fastrtps_dynamic_cpp/src/rmw_client.cpp | 14 ++++++++++++++ rmw_fastrtps_dynamic_cpp/src/rmw_event.cpp | 14 ++++++++++++++ rmw_fastrtps_dynamic_cpp/src/rmw_features.cpp | 1 - rmw_fastrtps_dynamic_cpp/src/rmw_service.cpp | 14 ++++++++++++++ rmw_fastrtps_dynamic_cpp/src/rmw_subscription.cpp | 14 ++++++++++++++ 9 files changed, 64 insertions(+), 1 deletion(-) diff --git a/rmw_fastrtps_cpp/src/rmw_client.cpp b/rmw_fastrtps_cpp/src/rmw_client.cpp index c71824383..875e99a3e 100644 --- a/rmw_fastrtps_cpp/src/rmw_client.cpp +++ b/rmw_fastrtps_cpp/src/rmw_client.cpp @@ -532,6 +532,8 @@ rmw_client_set_on_new_response_callback( rmw_event_callback_t callback, const void * user_data) { + RMW_CHECK_ARGUMENT_FOR_NULL(rmw_client, RMW_RET_INVALID_ARGUMENT); + return rmw_fastrtps_shared_cpp::__rmw_client_set_on_new_response_callback( rmw_client, callback, diff --git a/rmw_fastrtps_cpp/src/rmw_event.cpp b/rmw_fastrtps_cpp/src/rmw_event.cpp index 9bdc819e7..56d8779e2 100644 --- a/rmw_fastrtps_cpp/src/rmw_event.cpp +++ b/rmw_fastrtps_cpp/src/rmw_event.cpp @@ -54,6 +54,8 @@ rmw_event_set_callback( rmw_event_callback_t callback, const void * user_data) { + RMW_CHECK_ARGUMENT_FOR_NULL(rmw_event, RMW_RET_INVALID_ARGUMENT); + return rmw_fastrtps_shared_cpp::__rmw_event_set_callback( rmw_event, callback, diff --git a/rmw_fastrtps_cpp/src/rmw_service.cpp b/rmw_fastrtps_cpp/src/rmw_service.cpp index cac7dd83f..6be16ca8e 100644 --- a/rmw_fastrtps_cpp/src/rmw_service.cpp +++ b/rmw_fastrtps_cpp/src/rmw_service.cpp @@ -531,6 +531,8 @@ rmw_service_set_on_new_request_callback( rmw_event_callback_t callback, const void * user_data) { + RMW_CHECK_ARGUMENT_FOR_NULL(rmw_service, RMW_RET_INVALID_ARGUMENT); + return rmw_fastrtps_shared_cpp::__rmw_service_set_on_new_request_callback( rmw_service, callback, diff --git a/rmw_fastrtps_cpp/src/rmw_subscription.cpp b/rmw_fastrtps_cpp/src/rmw_subscription.cpp index c25466084..1917b6d8b 100644 --- a/rmw_fastrtps_cpp/src/rmw_subscription.cpp +++ b/rmw_fastrtps_cpp/src/rmw_subscription.cpp @@ -215,6 +215,8 @@ rmw_subscription_set_on_new_message_callback( rmw_event_callback_t callback, const void * user_data) { + RMW_CHECK_ARGUMENT_FOR_NULL(rmw_subscription, RMW_RET_INVALID_ARGUMENT); + return rmw_fastrtps_shared_cpp::__rmw_subscription_set_on_new_message_callback( rmw_subscription, callback, diff --git a/rmw_fastrtps_dynamic_cpp/src/rmw_client.cpp b/rmw_fastrtps_dynamic_cpp/src/rmw_client.cpp index b72852ac0..81d7de351 100644 --- a/rmw_fastrtps_dynamic_cpp/src/rmw_client.cpp +++ b/rmw_fastrtps_dynamic_cpp/src/rmw_client.cpp @@ -572,4 +572,18 @@ rmw_client_response_subscription_get_actual_qos( return rmw_fastrtps_shared_cpp::__rmw_client_response_subscription_get_actual_qos(client, qos); } + +rmw_ret_t +rmw_client_set_on_new_response_callback( + rmw_client_t * rmw_client, + rmw_event_callback_t callback, + const void * user_data) +{ + RMW_CHECK_ARGUMENT_FOR_NULL(rmw_client, RMW_RET_INVALID_ARGUMENT); + + return rmw_fastrtps_shared_cpp::__rmw_client_set_on_new_response_callback( + rmw_client, + callback, + user_data); +} } // extern "C" diff --git a/rmw_fastrtps_dynamic_cpp/src/rmw_event.cpp b/rmw_fastrtps_dynamic_cpp/src/rmw_event.cpp index c4b5a72b1..13163579d 100644 --- a/rmw_fastrtps_dynamic_cpp/src/rmw_event.cpp +++ b/rmw_fastrtps_dynamic_cpp/src/rmw_event.cpp @@ -47,4 +47,18 @@ rmw_subscription_event_init( subscription->data, event_type); } + +rmw_ret_t +rmw_event_set_callback( + rmw_event_t * rmw_event, + rmw_event_callback_t callback, + const void * user_data) +{ + RMW_CHECK_ARGUMENT_FOR_NULL(rmw_event, RMW_RET_INVALID_ARGUMENT); + + return rmw_fastrtps_shared_cpp::__rmw_event_set_callback( + rmw_event, + callback, + user_data); +} } // extern "C" diff --git a/rmw_fastrtps_dynamic_cpp/src/rmw_features.cpp b/rmw_fastrtps_dynamic_cpp/src/rmw_features.cpp index 13745a7ae..79379b892 100644 --- a/rmw_fastrtps_dynamic_cpp/src/rmw_features.cpp +++ b/rmw_fastrtps_dynamic_cpp/src/rmw_features.cpp @@ -18,7 +18,6 @@ extern "C" { - bool rmw_feature_supported(rmw_feature_t feature) { diff --git a/rmw_fastrtps_dynamic_cpp/src/rmw_service.cpp b/rmw_fastrtps_dynamic_cpp/src/rmw_service.cpp index a0d5f4bd3..269f3cee9 100644 --- a/rmw_fastrtps_dynamic_cpp/src/rmw_service.cpp +++ b/rmw_fastrtps_dynamic_cpp/src/rmw_service.cpp @@ -571,4 +571,18 @@ rmw_service_request_subscription_get_actual_qos( return rmw_fastrtps_shared_cpp::__rmw_service_request_subscription_get_actual_qos(service, qos); } + +rmw_ret_t +rmw_service_set_on_new_request_callback( + rmw_service_t * rmw_service, + rmw_event_callback_t callback, + const void * user_data) +{ + RMW_CHECK_ARGUMENT_FOR_NULL(rmw_service, RMW_RET_INVALID_ARGUMENT); + + return rmw_fastrtps_shared_cpp::__rmw_service_set_on_new_request_callback( + rmw_service, + callback, + user_data); +} } // extern "C" diff --git a/rmw_fastrtps_dynamic_cpp/src/rmw_subscription.cpp b/rmw_fastrtps_dynamic_cpp/src/rmw_subscription.cpp index d3059c42a..7da462d07 100644 --- a/rmw_fastrtps_dynamic_cpp/src/rmw_subscription.cpp +++ b/rmw_fastrtps_dynamic_cpp/src/rmw_subscription.cpp @@ -209,4 +209,18 @@ rmw_destroy_subscription(rmw_node_t * node, rmw_subscription_t * subscription) return rmw_fastrtps_shared_cpp::__rmw_destroy_subscription( eprosima_fastrtps_identifier, node, subscription); } + +rmw_ret_t +rmw_subscription_set_on_new_message_callback( + rmw_subscription_t * rmw_subscription, + rmw_event_callback_t callback, + const void * user_data) +{ + RMW_CHECK_ARGUMENT_FOR_NULL(rmw_subscription, RMW_RET_INVALID_ARGUMENT); + + return rmw_fastrtps_shared_cpp::__rmw_subscription_set_on_new_message_callback( + rmw_subscription, + callback, + user_data); +} } // extern "C"