From f25d4c64b681d6aa811831c705afb3de7956efd5 Mon Sep 17 00:00:00 2001 From: Mauro Date: Mon, 12 Oct 2020 13:28:03 +0100 Subject: [PATCH 1/4] Rename EventQ -> ExecutorEvent --- .../include/rclcpp/executors/events_executor.hpp | 8 ++++---- rclcpp/src/rclcpp/executors/events_executor.cpp | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/rclcpp/include/rclcpp/executors/events_executor.hpp b/rclcpp/include/rclcpp/executors/events_executor.hpp index b077eb727f..f3d3ddfe35 100644 --- a/rclcpp/include/rclcpp/executors/events_executor.hpp +++ b/rclcpp/include/rclcpp/executors/events_executor.hpp @@ -137,18 +137,18 @@ class EventsExecutor : public rclcpp::Executor /// Extract and execute events from the queue until it is empty RCLCPP_PUBLIC void - consume_all_events(std::queue &queue); + consume_all_events(std::queue &queue); // Execute a single event RCLCPP_PUBLIC void - execute_event(const EventQ &event); + execute_event(const ExecutorEvent &event); // Executor callback: Push new events into the queue and trigger cv. // This function is called by the DDS entities when an event happened, // like a subscription receiving a message. static void - push_event(const void * executor_ptr, EventQ event) + push_event(const void * executor_ptr, ExecutorEvent event) { // Cast executor_ptr to this (need to remove constness) auto this_executor = const_cast( @@ -165,7 +165,7 @@ class EventsExecutor : public rclcpp::Executor } // Event queue members - std::queue event_queue_; + std::queue event_queue_; std::mutex event_queue_mutex_; std::condition_variable event_queue_cv_; diff --git a/rclcpp/src/rclcpp/executors/events_executor.cpp b/rclcpp/src/rclcpp/executors/events_executor.cpp index 9bf592130c..9bf0b4e0aa 100644 --- a/rclcpp/src/rclcpp/executors/events_executor.cpp +++ b/rclcpp/src/rclcpp/executors/events_executor.cpp @@ -84,7 +84,7 @@ EventsExecutor::spin() auto predicate = [this]() { return !event_queue_.empty(); }; // Local event queue - std::queue local_event_queue; + std::queue local_event_queue; timers_manager_->start(); @@ -124,7 +124,7 @@ EventsExecutor::spin_some(std::chrono::nanoseconds max_duration) max_duration = next_timer_timeout; } - std::queue local_event_queue; + std::queue local_event_queue; { // Wait until timeout or event @@ -149,7 +149,7 @@ EventsExecutor::spin_all(std::chrono::nanoseconds max_duration) } RCLCPP_SCOPE_EXIT(this->spinning.store(false);); - std::queue local_event_queue; + std::queue local_event_queue; auto start = std::chrono::steady_clock::now(); auto max_duration_not_elapsed = [max_duration, start]() { @@ -204,7 +204,7 @@ EventsExecutor::spin_once_impl(std::chrono::nanoseconds timeout) timeout = next_timer_timeout; } - EventQ event; + ExecutorEvent event; bool has_event = false; { @@ -327,7 +327,7 @@ EventsExecutor::handle_events() auto predicate = [this]() { return !event_queue_.empty(); }; // Local event queue - std::queue local_event_queue; + std::queue local_event_queue; // Scope block for the mutex { @@ -343,10 +343,10 @@ EventsExecutor::handle_events() } void -EventsExecutor::consume_all_events(std::queue &event_queue) +EventsExecutor::consume_all_events(std::queue &event_queue) { while (!event_queue.empty()) { - EventQ event = event_queue.front(); + ExecutorEvent event = event_queue.front(); event_queue.pop(); this->execute_event(event); @@ -354,7 +354,7 @@ EventsExecutor::consume_all_events(std::queue &event_queue) } void -EventsExecutor::execute_event(const EventQ &event) +EventsExecutor::execute_event(const ExecutorEvent &event) { switch(event.type) { case SUBSCRIPTION_EVENT: From a8feedc933fcebb854da25a11429d5e5bc141253 Mon Sep 17 00:00:00 2001 From: Mauro Date: Mon, 12 Oct 2020 13:43:04 +0100 Subject: [PATCH 2/4] rename set_guard_condition_callback -> set_callback --- .../rclcpp/experimental/subscription_intra_process_base.hpp | 2 +- rclcpp/include/rclcpp/waitable.hpp | 2 +- rclcpp/src/rclcpp/executors/events_executor.cpp | 2 +- .../rclcpp/executors/events_executor_entities_collector.cpp | 4 ++-- rclcpp/src/rclcpp/subscription_intra_process_base.cpp | 2 +- rclcpp/src/rclcpp/waitable.cpp | 4 ++-- rclcpp/test/rclcpp/executors/test_executors.cpp | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/rclcpp/include/rclcpp/experimental/subscription_intra_process_base.hpp b/rclcpp/include/rclcpp/experimental/subscription_intra_process_base.hpp index e75fe5d65c..ba443c830f 100644 --- a/rclcpp/include/rclcpp/experimental/subscription_intra_process_base.hpp +++ b/rclcpp/include/rclcpp/experimental/subscription_intra_process_base.hpp @@ -72,7 +72,7 @@ class SubscriptionIntraProcessBase : public rclcpp::Waitable RCLCPP_PUBLIC void - set_guard_condition_callback( + set_callback( void * executor_context, Event_callback executor_callback) const override; diff --git a/rclcpp/include/rclcpp/waitable.hpp b/rclcpp/include/rclcpp/waitable.hpp index e39e01b294..aa19af1ff9 100644 --- a/rclcpp/include/rclcpp/waitable.hpp +++ b/rclcpp/include/rclcpp/waitable.hpp @@ -168,7 +168,7 @@ class Waitable RCLCPP_PUBLIC virtual void - set_guard_condition_callback( + set_callback( void * executor_context, Event_callback executor_callback) const; diff --git a/rclcpp/src/rclcpp/executors/events_executor.cpp b/rclcpp/src/rclcpp/executors/events_executor.cpp index 9bf0b4e0aa..7121d43f36 100644 --- a/rclcpp/src/rclcpp/executors/events_executor.cpp +++ b/rclcpp/src/rclcpp/executors/events_executor.cpp @@ -277,7 +277,7 @@ EventsExecutor::add_node( group->find_waitable_ptrs_if( [this](const rclcpp::Waitable::SharedPtr & waitable) { if (waitable) { - waitable->set_guard_condition_callback(this, &EventsExecutor::push_event); + waitable->set_callback(this, &EventsExecutor::push_event); } return false; }); diff --git a/rclcpp/src/rclcpp/executors/events_executor_entities_collector.cpp b/rclcpp/src/rclcpp/executors/events_executor_entities_collector.cpp index 1379cdb75e..329cc8af9d 100644 --- a/rclcpp/src/rclcpp/executors/events_executor_entities_collector.cpp +++ b/rclcpp/src/rclcpp/executors/events_executor_entities_collector.cpp @@ -131,7 +131,7 @@ EventsExecutorEntitiesCollector::remove_node( group->find_waitable_ptrs_if( [this](const rclcpp::Waitable::SharedPtr & waitable) { if (waitable) { - waitable->set_guard_condition_callback(nullptr, nullptr); + waitable->set_callback(nullptr, nullptr); } return false; }); @@ -190,7 +190,7 @@ EventsExecutorEntitiesCollector::set_entities_callbacks() group->find_waitable_ptrs_if( [this](const rclcpp::Waitable::SharedPtr & waitable) { if (waitable) { - waitable->set_guard_condition_callback(executor_context_, executor_callback_); + waitable->set_callback(executor_context_, executor_callback_); } return false; }); diff --git a/rclcpp/src/rclcpp/subscription_intra_process_base.cpp b/rclcpp/src/rclcpp/subscription_intra_process_base.cpp index c3df2b5004..c0df487dc2 100644 --- a/rclcpp/src/rclcpp/subscription_intra_process_base.cpp +++ b/rclcpp/src/rclcpp/subscription_intra_process_base.cpp @@ -38,7 +38,7 @@ SubscriptionIntraProcessBase::get_actual_qos() const } void -SubscriptionIntraProcessBase::set_guard_condition_callback( +SubscriptionIntraProcessBase::set_callback( void * executor_context, Event_callback executor_callback) const { diff --git a/rclcpp/src/rclcpp/waitable.cpp b/rclcpp/src/rclcpp/waitable.cpp index 7764e4b818..72c64af365 100644 --- a/rclcpp/src/rclcpp/waitable.cpp +++ b/rclcpp/src/rclcpp/waitable.cpp @@ -61,12 +61,12 @@ Waitable::exchange_in_use_by_wait_set_state(bool in_use_state) } void -Waitable::set_guard_condition_callback( +Waitable::set_callback( void * executor_context, Event_callback executor_callback) const { (void)executor_context; (void)executor_callback; - throw std::runtime_error("Custom waitables should override set_guard_condition_callback() to use events executor"); + throw std::runtime_error("Custom waitables should override set_callback() to use events executor"); } diff --git a/rclcpp/test/rclcpp/executors/test_executors.cpp b/rclcpp/test/rclcpp/executors/test_executors.cpp index 353186c683..846a780109 100644 --- a/rclcpp/test/rclcpp/executors/test_executors.cpp +++ b/rclcpp/test/rclcpp/executors/test_executors.cpp @@ -453,7 +453,7 @@ class TestWaitable : public rclcpp::Waitable } void - set_guard_condition_callback( + set_callback( void * executor_context, Event_callback executor_callback) const override { From b91edeac52ec6d51adb99b19ca39f7cefd5a7463 Mon Sep 17 00:00:00 2001 From: Mauro Date: Mon, 12 Oct 2020 15:27:08 +0100 Subject: [PATCH 3/4] Rename to set_events_executor_callback --- rclcpp/include/rclcpp/client.hpp | 2 +- .../subscription_intra_process_base.hpp | 2 +- rclcpp/include/rclcpp/service.hpp | 2 +- rclcpp/include/rclcpp/subscription_base.hpp | 2 +- rclcpp/include/rclcpp/waitable.hpp | 2 +- rclcpp/src/rclcpp/client.cpp | 4 ++-- .../src/rclcpp/executors/events_executor.cpp | 14 +++++++------- .../events_executor_entities_collector.cpp | 18 +++++++++--------- rclcpp/src/rclcpp/service.cpp | 4 ++-- rclcpp/src/rclcpp/subscription_base.cpp | 4 ++-- .../rclcpp/subscription_intra_process_base.cpp | 4 ++-- rclcpp/src/rclcpp/waitable.cpp | 4 ++-- 12 files changed, 31 insertions(+), 31 deletions(-) diff --git a/rclcpp/include/rclcpp/client.hpp b/rclcpp/include/rclcpp/client.hpp index ab6ccf91db..625030e8b2 100644 --- a/rclcpp/include/rclcpp/client.hpp +++ b/rclcpp/include/rclcpp/client.hpp @@ -152,7 +152,7 @@ class ClientBase RCLCPP_PUBLIC void - set_callback(const void * executor_context, Event_callback executor_callback) const; + set_events_executor_callback(const void * executor_context, Event_callback executor_callback) const; protected: RCLCPP_DISABLE_COPY(ClientBase) diff --git a/rclcpp/include/rclcpp/experimental/subscription_intra_process_base.hpp b/rclcpp/include/rclcpp/experimental/subscription_intra_process_base.hpp index ba443c830f..fbeada7432 100644 --- a/rclcpp/include/rclcpp/experimental/subscription_intra_process_base.hpp +++ b/rclcpp/include/rclcpp/experimental/subscription_intra_process_base.hpp @@ -72,7 +72,7 @@ class SubscriptionIntraProcessBase : public rclcpp::Waitable RCLCPP_PUBLIC void - set_callback( + set_events_executor_callback( void * executor_context, Event_callback executor_callback) const override; diff --git a/rclcpp/include/rclcpp/service.hpp b/rclcpp/include/rclcpp/service.hpp index fc0ebe6f8e..e6690c1ef6 100644 --- a/rclcpp/include/rclcpp/service.hpp +++ b/rclcpp/include/rclcpp/service.hpp @@ -123,7 +123,7 @@ class ServiceBase RCLCPP_PUBLIC void - set_callback(const void * executor_context, Event_callback executor_callback) const; + set_events_executor_callback(const void * executor_context, Event_callback executor_callback) const; protected: RCLCPP_DISABLE_COPY(ServiceBase) diff --git a/rclcpp/include/rclcpp/subscription_base.hpp b/rclcpp/include/rclcpp/subscription_base.hpp index 8e82f430d2..a5cd265cb4 100644 --- a/rclcpp/include/rclcpp/subscription_base.hpp +++ b/rclcpp/include/rclcpp/subscription_base.hpp @@ -265,7 +265,7 @@ class SubscriptionBase : public std::enable_shared_from_this RCLCPP_PUBLIC void - set_callback(const void * executor_context, Event_callback executor_callback) const; + set_events_executor_callback(const void * executor_context, Event_callback executor_callback) const; protected: template diff --git a/rclcpp/include/rclcpp/waitable.hpp b/rclcpp/include/rclcpp/waitable.hpp index aa19af1ff9..4aa9883b47 100644 --- a/rclcpp/include/rclcpp/waitable.hpp +++ b/rclcpp/include/rclcpp/waitable.hpp @@ -168,7 +168,7 @@ class Waitable RCLCPP_PUBLIC virtual void - set_callback( + set_events_executor_callback( void * executor_context, Event_callback executor_callback) const; diff --git a/rclcpp/src/rclcpp/client.cpp b/rclcpp/src/rclcpp/client.cpp index adae1e250a..626aa92945 100644 --- a/rclcpp/src/rclcpp/client.cpp +++ b/rclcpp/src/rclcpp/client.cpp @@ -200,11 +200,11 @@ ClientBase::exchange_in_use_by_wait_set_state(bool in_use_state) } void -ClientBase::set_callback( +ClientBase::set_events_executor_callback( const void * executor_context, Event_callback executor_callback) const { - rcl_ret_t ret = rcl_client_set_callback( + rcl_ret_t ret = rcl_client_set_events_executor_callback( executor_context, executor_callback, this, diff --git a/rclcpp/src/rclcpp/executors/events_executor.cpp b/rclcpp/src/rclcpp/executors/events_executor.cpp index 7121d43f36..0de36e491a 100644 --- a/rclcpp/src/rclcpp/executors/events_executor.cpp +++ b/rclcpp/src/rclcpp/executors/events_executor.cpp @@ -46,7 +46,7 @@ EventsExecutor::EventsExecutor( rcl_ret_t ret; // Set the global ctrl-c guard condition callback - ret = rcl_guard_condition_set_callback( + ret = rcl_guard_condition_set_events_executor_callback( this, &EventsExecutor::push_event, entities_collector_.get(), @@ -58,7 +58,7 @@ EventsExecutor::EventsExecutor( } // Set the executor interrupt guard condition callback - ret = rcl_guard_condition_set_callback( + ret = rcl_guard_condition_set_events_executor_callback( this, &EventsExecutor::push_event, entities_collector_.get(), @@ -256,28 +256,28 @@ EventsExecutor::add_node( group->find_subscription_ptrs_if( [this](const rclcpp::SubscriptionBase::SharedPtr & subscription) { if (subscription) { - subscription->set_callback(this, &EventsExecutor::push_event); + subscription->set_events_executor_callback(this, &EventsExecutor::push_event); } return false; }); group->find_service_ptrs_if( [this](const rclcpp::ServiceBase::SharedPtr & service) { if (service) { - service->set_callback(this, &EventsExecutor::push_event); + service->set_events_executor_callback(this, &EventsExecutor::push_event); } return false; }); group->find_client_ptrs_if( [this](const rclcpp::ClientBase::SharedPtr & client) { if (client) { - client->set_callback(this, &EventsExecutor::push_event); + client->set_events_executor_callback(this, &EventsExecutor::push_event); } return false; }); group->find_waitable_ptrs_if( [this](const rclcpp::Waitable::SharedPtr & waitable) { if (waitable) { - waitable->set_callback(this, &EventsExecutor::push_event); + waitable->set_events_executor_callback(this, &EventsExecutor::push_event); } return false; }); @@ -285,7 +285,7 @@ EventsExecutor::add_node( // Set node's guard condition callback, so if new entities are added while // spinning we can set their callback. - rcl_ret_t ret = rcl_guard_condition_set_callback( + rcl_ret_t ret = rcl_guard_condition_set_events_executor_callback( this, &EventsExecutor::push_event, entities_collector_.get(), diff --git a/rclcpp/src/rclcpp/executors/events_executor_entities_collector.cpp b/rclcpp/src/rclcpp/executors/events_executor_entities_collector.cpp index 329cc8af9d..ac9481da59 100644 --- a/rclcpp/src/rclcpp/executors/events_executor_entities_collector.cpp +++ b/rclcpp/src/rclcpp/executors/events_executor_entities_collector.cpp @@ -85,7 +85,7 @@ EventsExecutorEntitiesCollector::remove_node( bool matched = (node_it->lock() == node_ptr); if (matched) { // Node found: unset its entities callbacks - rcl_ret_t ret = rcl_guard_condition_set_callback( + rcl_ret_t ret = rcl_guard_condition_set_events_executor_callback( nullptr, nullptr, nullptr, node_ptr->get_notify_guard_condition(), false); @@ -110,28 +110,28 @@ EventsExecutorEntitiesCollector::remove_node( group->find_subscription_ptrs_if( [this](const rclcpp::SubscriptionBase::SharedPtr & subscription) { if (subscription) { - subscription->set_callback(nullptr, nullptr); + subscription->set_events_executor_callback(nullptr, nullptr); } return false; }); group->find_service_ptrs_if( [this](const rclcpp::ServiceBase::SharedPtr & service) { if (service) { - service->set_callback(nullptr, nullptr); + service->set_events_executor_callback(nullptr, nullptr); } return false; }); group->find_client_ptrs_if( [this](const rclcpp::ClientBase::SharedPtr & client) { if (client) { - client->set_callback(nullptr, nullptr); + client->set_events_executor_callback(nullptr, nullptr); } return false; }); group->find_waitable_ptrs_if( [this](const rclcpp::Waitable::SharedPtr & waitable) { if (waitable) { - waitable->set_callback(nullptr, nullptr); + waitable->set_events_executor_callback(nullptr, nullptr); } return false; }); @@ -169,28 +169,28 @@ EventsExecutorEntitiesCollector::set_entities_callbacks() group->find_subscription_ptrs_if( [this](const rclcpp::SubscriptionBase::SharedPtr & subscription) { if (subscription) { - subscription->set_callback(executor_context_, executor_callback_); + subscription->set_events_executor_callback(executor_context_, executor_callback_); } return false; }); group->find_service_ptrs_if( [this](const rclcpp::ServiceBase::SharedPtr & service) { if (service) { - service->set_callback(executor_context_, executor_callback_); + service->set_events_executor_callback(executor_context_, executor_callback_); } return false; }); group->find_client_ptrs_if( [this](const rclcpp::ClientBase::SharedPtr & client) { if (client) { - client->set_callback(executor_context_, executor_callback_); + client->set_events_executor_callback(executor_context_, executor_callback_); } return false; }); group->find_waitable_ptrs_if( [this](const rclcpp::Waitable::SharedPtr & waitable) { if (waitable) { - waitable->set_callback(executor_context_, executor_callback_); + waitable->set_events_executor_callback(executor_context_, executor_callback_); } return false; }); diff --git a/rclcpp/src/rclcpp/service.cpp b/rclcpp/src/rclcpp/service.cpp index 3f1302c875..a87fdefc24 100644 --- a/rclcpp/src/rclcpp/service.cpp +++ b/rclcpp/src/rclcpp/service.cpp @@ -86,11 +86,11 @@ ServiceBase::exchange_in_use_by_wait_set_state(bool in_use_state) } void -ServiceBase::set_callback( +ServiceBase::set_events_executor_callback( const void * executor_context, Event_callback executor_callback) const { - rcl_ret_t ret = rcl_service_set_callback( + rcl_ret_t ret = rcl_service_set_events_executor_callback( executor_context, executor_callback, this, diff --git a/rclcpp/src/rclcpp/subscription_base.cpp b/rclcpp/src/rclcpp/subscription_base.cpp index d9c72812a3..850701cc7c 100644 --- a/rclcpp/src/rclcpp/subscription_base.cpp +++ b/rclcpp/src/rclcpp/subscription_base.cpp @@ -290,11 +290,11 @@ SubscriptionBase::exchange_in_use_by_wait_set_state( } void -SubscriptionBase::set_callback( +SubscriptionBase::set_events_executor_callback( const void * executor_context, Event_callback executor_callback) const { - rcl_ret_t ret = rcl_subscription_set_callback( + rcl_ret_t ret = rcl_subscription_set_events_executor_callback( executor_context, executor_callback, this, diff --git a/rclcpp/src/rclcpp/subscription_intra_process_base.cpp b/rclcpp/src/rclcpp/subscription_intra_process_base.cpp index c0df487dc2..b245b569d7 100644 --- a/rclcpp/src/rclcpp/subscription_intra_process_base.cpp +++ b/rclcpp/src/rclcpp/subscription_intra_process_base.cpp @@ -38,11 +38,11 @@ SubscriptionIntraProcessBase::get_actual_qos() const } void -SubscriptionIntraProcessBase::set_callback( +SubscriptionIntraProcessBase::set_events_executor_callback( void * executor_context, Event_callback executor_callback) const { - rcl_ret_t ret = rcl_guard_condition_set_callback( + rcl_ret_t ret = rcl_guard_condition_set_events_executor_callback( executor_context, executor_callback, this, diff --git a/rclcpp/src/rclcpp/waitable.cpp b/rclcpp/src/rclcpp/waitable.cpp index 72c64af365..90a91f2f05 100644 --- a/rclcpp/src/rclcpp/waitable.cpp +++ b/rclcpp/src/rclcpp/waitable.cpp @@ -61,12 +61,12 @@ Waitable::exchange_in_use_by_wait_set_state(bool in_use_state) } void -Waitable::set_callback( +Waitable::set_events_executor_callback( void * executor_context, Event_callback executor_callback) const { (void)executor_context; (void)executor_callback; - throw std::runtime_error("Custom waitables should override set_callback() to use events executor"); + throw std::runtime_error("Custom waitables should override set_events_executor_callback() to use events executor"); } From caf353224dd346a214afc885133c2705390d6492 Mon Sep 17 00:00:00 2001 From: Mauro Date: Mon, 12 Oct 2020 16:16:59 +0100 Subject: [PATCH 4/4] Rename to ExecutorEventCallback --- rclcpp/include/rclcpp/client.hpp | 2 +- rclcpp/include/rclcpp/executors/events_executor.hpp | 2 +- .../rclcpp/executors/events_executor_entities_collector.hpp | 4 ++-- .../rclcpp/experimental/subscription_intra_process_base.hpp | 2 +- rclcpp/include/rclcpp/service.hpp | 2 +- rclcpp/include/rclcpp/subscription_base.hpp | 2 +- rclcpp/include/rclcpp/waitable.hpp | 2 +- rclcpp/src/rclcpp/client.cpp | 2 +- rclcpp/src/rclcpp/executors/events_executor.cpp | 2 +- .../rclcpp/executors/events_executor_entities_collector.cpp | 2 +- rclcpp/src/rclcpp/service.cpp | 2 +- rclcpp/src/rclcpp/subscription_base.cpp | 2 +- rclcpp/src/rclcpp/subscription_intra_process_base.cpp | 2 +- rclcpp/src/rclcpp/waitable.cpp | 2 +- rclcpp/test/rclcpp/executors/test_executors.cpp | 2 +- 15 files changed, 16 insertions(+), 16 deletions(-) diff --git a/rclcpp/include/rclcpp/client.hpp b/rclcpp/include/rclcpp/client.hpp index 625030e8b2..129f7209af 100644 --- a/rclcpp/include/rclcpp/client.hpp +++ b/rclcpp/include/rclcpp/client.hpp @@ -152,7 +152,7 @@ class ClientBase RCLCPP_PUBLIC void - set_events_executor_callback(const void * executor_context, Event_callback executor_callback) const; + set_events_executor_callback(const void * executor_context, ExecutorEventCallback executor_callback) const; protected: RCLCPP_DISABLE_COPY(ClientBase) diff --git a/rclcpp/include/rclcpp/executors/events_executor.hpp b/rclcpp/include/rclcpp/executors/events_executor.hpp index f3d3ddfe35..a5ba7c51e1 100644 --- a/rclcpp/include/rclcpp/executors/events_executor.hpp +++ b/rclcpp/include/rclcpp/executors/events_executor.hpp @@ -19,7 +19,7 @@ #include #include -#include "rcutils/event_types.h" +#include "rcutils/executor_event_types.h" #include "rclcpp/executor.hpp" #include "rclcpp/executors/events_executor_entities_collector.hpp" diff --git a/rclcpp/include/rclcpp/executors/events_executor_entities_collector.hpp b/rclcpp/include/rclcpp/executors/events_executor_entities_collector.hpp index 96540f74ce..8e4f57b3ac 100644 --- a/rclcpp/include/rclcpp/executors/events_executor_entities_collector.hpp +++ b/rclcpp/include/rclcpp/executors/events_executor_entities_collector.hpp @@ -45,7 +45,7 @@ class EventsExecutorEntitiesCollector final : public rclcpp::Waitable void init( void * executor_context, - Event_callback executor_callback, + ExecutorEventCallback executor_callback, TimerFn push_timer, TimerFn clear_timer, ClearTimersFn clear_all_timers); @@ -91,7 +91,7 @@ class EventsExecutorEntitiesCollector final : public rclcpp::Waitable void * executor_context_ = nullptr; /// Events callback - Event_callback executor_callback_ = nullptr; + ExecutorEventCallback executor_callback_ = nullptr; /// Function pointers to push and clear timers from the timers heap TimerFn push_timer_ = nullptr; diff --git a/rclcpp/include/rclcpp/experimental/subscription_intra_process_base.hpp b/rclcpp/include/rclcpp/experimental/subscription_intra_process_base.hpp index fbeada7432..a961ef23c8 100644 --- a/rclcpp/include/rclcpp/experimental/subscription_intra_process_base.hpp +++ b/rclcpp/include/rclcpp/experimental/subscription_intra_process_base.hpp @@ -74,7 +74,7 @@ class SubscriptionIntraProcessBase : public rclcpp::Waitable void set_events_executor_callback( void * executor_context, - Event_callback executor_callback) const override; + ExecutorEventCallback executor_callback) const override; protected: std::recursive_mutex reentrant_mutex_; diff --git a/rclcpp/include/rclcpp/service.hpp b/rclcpp/include/rclcpp/service.hpp index e6690c1ef6..eb5fd197f2 100644 --- a/rclcpp/include/rclcpp/service.hpp +++ b/rclcpp/include/rclcpp/service.hpp @@ -123,7 +123,7 @@ class ServiceBase RCLCPP_PUBLIC void - set_events_executor_callback(const void * executor_context, Event_callback executor_callback) const; + set_events_executor_callback(const void * executor_context, ExecutorEventCallback executor_callback) const; protected: RCLCPP_DISABLE_COPY(ServiceBase) diff --git a/rclcpp/include/rclcpp/subscription_base.hpp b/rclcpp/include/rclcpp/subscription_base.hpp index a5cd265cb4..320895bd33 100644 --- a/rclcpp/include/rclcpp/subscription_base.hpp +++ b/rclcpp/include/rclcpp/subscription_base.hpp @@ -265,7 +265,7 @@ class SubscriptionBase : public std::enable_shared_from_this RCLCPP_PUBLIC void - set_events_executor_callback(const void * executor_context, Event_callback executor_callback) const; + set_events_executor_callback(const void * executor_context, ExecutorEventCallback executor_callback) const; protected: template diff --git a/rclcpp/include/rclcpp/waitable.hpp b/rclcpp/include/rclcpp/waitable.hpp index 4aa9883b47..73ff886f44 100644 --- a/rclcpp/include/rclcpp/waitable.hpp +++ b/rclcpp/include/rclcpp/waitable.hpp @@ -170,7 +170,7 @@ class Waitable void set_events_executor_callback( void * executor_context, - Event_callback executor_callback) const; + ExecutorEventCallback executor_callback) const; private: std::atomic in_use_by_wait_set_{false}; diff --git a/rclcpp/src/rclcpp/client.cpp b/rclcpp/src/rclcpp/client.cpp index 626aa92945..f4cfc40b31 100644 --- a/rclcpp/src/rclcpp/client.cpp +++ b/rclcpp/src/rclcpp/client.cpp @@ -202,7 +202,7 @@ ClientBase::exchange_in_use_by_wait_set_state(bool in_use_state) void ClientBase::set_events_executor_callback( const void * executor_context, - Event_callback executor_callback) const + ExecutorEventCallback executor_callback) const { rcl_ret_t ret = rcl_client_set_events_executor_callback( executor_context, diff --git a/rclcpp/src/rclcpp/executors/events_executor.cpp b/rclcpp/src/rclcpp/executors/events_executor.cpp index 0de36e491a..63be1570b8 100644 --- a/rclcpp/src/rclcpp/executors/events_executor.cpp +++ b/rclcpp/src/rclcpp/executors/events_executor.cpp @@ -381,7 +381,7 @@ EventsExecutor::execute_event(const ExecutorEvent &event) break; } - case GUARD_CONDITION_EVENT: + case WAITABLE_EVENT: { auto waitable = const_cast( static_cast(event.entity)); diff --git a/rclcpp/src/rclcpp/executors/events_executor_entities_collector.cpp b/rclcpp/src/rclcpp/executors/events_executor_entities_collector.cpp index ac9481da59..92e8cd38ce 100644 --- a/rclcpp/src/rclcpp/executors/events_executor_entities_collector.cpp +++ b/rclcpp/src/rclcpp/executors/events_executor_entities_collector.cpp @@ -33,7 +33,7 @@ EventsExecutorEntitiesCollector::~EventsExecutorEntitiesCollector() void EventsExecutorEntitiesCollector::init( void * executor_context, - Event_callback executor_callback, + ExecutorEventCallback executor_callback, TimerFn push_timer, TimerFn clear_timer, ClearTimersFn clear_all_timers) diff --git a/rclcpp/src/rclcpp/service.cpp b/rclcpp/src/rclcpp/service.cpp index a87fdefc24..a178314e91 100644 --- a/rclcpp/src/rclcpp/service.cpp +++ b/rclcpp/src/rclcpp/service.cpp @@ -88,7 +88,7 @@ ServiceBase::exchange_in_use_by_wait_set_state(bool in_use_state) void ServiceBase::set_events_executor_callback( const void * executor_context, - Event_callback executor_callback) const + ExecutorEventCallback executor_callback) const { rcl_ret_t ret = rcl_service_set_events_executor_callback( executor_context, diff --git a/rclcpp/src/rclcpp/subscription_base.cpp b/rclcpp/src/rclcpp/subscription_base.cpp index 850701cc7c..073168748e 100644 --- a/rclcpp/src/rclcpp/subscription_base.cpp +++ b/rclcpp/src/rclcpp/subscription_base.cpp @@ -292,7 +292,7 @@ SubscriptionBase::exchange_in_use_by_wait_set_state( void SubscriptionBase::set_events_executor_callback( const void * executor_context, - Event_callback executor_callback) const + ExecutorEventCallback executor_callback) const { rcl_ret_t ret = rcl_subscription_set_events_executor_callback( executor_context, diff --git a/rclcpp/src/rclcpp/subscription_intra_process_base.cpp b/rclcpp/src/rclcpp/subscription_intra_process_base.cpp index b245b569d7..067cadf7eb 100644 --- a/rclcpp/src/rclcpp/subscription_intra_process_base.cpp +++ b/rclcpp/src/rclcpp/subscription_intra_process_base.cpp @@ -40,7 +40,7 @@ SubscriptionIntraProcessBase::get_actual_qos() const void SubscriptionIntraProcessBase::set_events_executor_callback( void * executor_context, - Event_callback executor_callback) const + ExecutorEventCallback executor_callback) const { rcl_ret_t ret = rcl_guard_condition_set_events_executor_callback( executor_context, diff --git a/rclcpp/src/rclcpp/waitable.cpp b/rclcpp/src/rclcpp/waitable.cpp index 90a91f2f05..f354145a79 100644 --- a/rclcpp/src/rclcpp/waitable.cpp +++ b/rclcpp/src/rclcpp/waitable.cpp @@ -63,7 +63,7 @@ Waitable::exchange_in_use_by_wait_set_state(bool in_use_state) void Waitable::set_events_executor_callback( void * executor_context, - Event_callback executor_callback) const + ExecutorEventCallback executor_callback) const { (void)executor_context; (void)executor_callback; diff --git a/rclcpp/test/rclcpp/executors/test_executors.cpp b/rclcpp/test/rclcpp/executors/test_executors.cpp index 846a780109..e3ed8d47ab 100644 --- a/rclcpp/test/rclcpp/executors/test_executors.cpp +++ b/rclcpp/test/rclcpp/executors/test_executors.cpp @@ -455,7 +455,7 @@ class TestWaitable : public rclcpp::Waitable void set_callback( void * executor_context, - Event_callback executor_callback) const override + ExecutorEventCallback executor_callback) const override { rcl_ret_t ret = rcl_guard_condition_set_callback( executor_context,