From c024189773843fb9a474e5e60b2c2c134bd814d2 Mon Sep 17 00:00:00 2001 From: Monika Idzik Date: Fri, 18 Oct 2019 13:08:43 +0200 Subject: [PATCH] Add override keyword to functions Signed-off-by: Monika Idzik --- .../executors/multi_threaded_executor.hpp | 2 +- .../executors/single_threaded_executor.hpp | 2 +- .../rclcpp/node_interfaces/node_base.hpp | 34 ++++++++--------- .../rclcpp/node_interfaces/node_clock.hpp | 2 +- .../rclcpp/node_interfaces/node_graph.hpp | 24 ++++++------ .../rclcpp/node_interfaces/node_logging.hpp | 4 +- .../rclcpp/node_interfaces/node_services.hpp | 4 +- .../rclcpp/node_interfaces/node_timers.hpp | 2 +- .../rclcpp/node_interfaces/node_waitables.hpp | 4 +- rclcpp/include/rclcpp/service.hpp | 6 +-- .../strategies/allocator_memory_strategy.hpp | 38 +++++++++---------- 11 files changed, 61 insertions(+), 61 deletions(-) diff --git a/rclcpp/include/rclcpp/executors/multi_threaded_executor.hpp b/rclcpp/include/rclcpp/executors/multi_threaded_executor.hpp index 316c016a45..fd9ad33cf0 100644 --- a/rclcpp/include/rclcpp/executors/multi_threaded_executor.hpp +++ b/rclcpp/include/rclcpp/executors/multi_threaded_executor.hpp @@ -62,7 +62,7 @@ class MultiThreadedExecutor : public executor::Executor RCLCPP_PUBLIC void - spin(); + spin() override; RCLCPP_PUBLIC size_t diff --git a/rclcpp/include/rclcpp/executors/single_threaded_executor.hpp b/rclcpp/include/rclcpp/executors/single_threaded_executor.hpp index f6bcfa755c..523c2e5657 100644 --- a/rclcpp/include/rclcpp/executors/single_threaded_executor.hpp +++ b/rclcpp/include/rclcpp/executors/single_threaded_executor.hpp @@ -56,7 +56,7 @@ class SingleThreadedExecutor : public executor::Executor // It will only be interrupt by a CTRL-C (managed by the global signal handler). RCLCPP_PUBLIC void - spin(); + spin() override; private: RCLCPP_DISABLE_COPY(SingleThreadedExecutor) diff --git a/rclcpp/include/rclcpp/node_interfaces/node_base.hpp b/rclcpp/include/rclcpp/node_interfaces/node_base.hpp index 0179ca5079..21257bca75 100644 --- a/rclcpp/include/rclcpp/node_interfaces/node_base.hpp +++ b/rclcpp/include/rclcpp/node_interfaces/node_base.hpp @@ -52,87 +52,87 @@ class NodeBase : public NodeBaseInterface RCLCPP_PUBLIC const char * - get_name() const; + get_name() const override; RCLCPP_PUBLIC const char * - get_namespace() const; + get_namespace() const override; RCLCPP_PUBLIC const char * - get_fully_qualified_name() const; + get_fully_qualified_name() const override; RCLCPP_PUBLIC rclcpp::Context::SharedPtr - get_context(); + get_context() override; RCLCPP_PUBLIC rcl_node_t * - get_rcl_node_handle(); + get_rcl_node_handle() override; RCLCPP_PUBLIC const rcl_node_t * - get_rcl_node_handle() const; + get_rcl_node_handle() const override; RCLCPP_PUBLIC std::shared_ptr - get_shared_rcl_node_handle(); + get_shared_rcl_node_handle() override; RCLCPP_PUBLIC std::shared_ptr - get_shared_rcl_node_handle() const; + get_shared_rcl_node_handle() const override; RCLCPP_PUBLIC bool - assert_liveliness() const; + assert_liveliness() const override; RCLCPP_PUBLIC rclcpp::callback_group::CallbackGroup::SharedPtr - create_callback_group(rclcpp::callback_group::CallbackGroupType group_type); + create_callback_group(rclcpp::callback_group::CallbackGroupType group_type) override; RCLCPP_PUBLIC rclcpp::callback_group::CallbackGroup::SharedPtr - get_default_callback_group(); + get_default_callback_group() override; RCLCPP_PUBLIC bool - callback_group_in_node(rclcpp::callback_group::CallbackGroup::SharedPtr group); + callback_group_in_node(rclcpp::callback_group::CallbackGroup::SharedPtr group) override; RCLCPP_PUBLIC const std::vector & - get_callback_groups() const; + get_callback_groups() const override; RCLCPP_PUBLIC std::atomic_bool & - get_associated_with_executor_atomic(); + get_associated_with_executor_atomic() override; RCLCPP_PUBLIC rcl_guard_condition_t * - get_notify_guard_condition(); + get_notify_guard_condition() override; RCLCPP_PUBLIC std::unique_lock - acquire_notify_guard_condition_lock() const; + acquire_notify_guard_condition_lock() const override; RCLCPP_PUBLIC bool - get_use_intra_process_default() const; + get_use_intra_process_default() const override; private: RCLCPP_DISABLE_COPY(NodeBase) diff --git a/rclcpp/include/rclcpp/node_interfaces/node_clock.hpp b/rclcpp/include/rclcpp/node_interfaces/node_clock.hpp index 67f1b7b7ec..1b0949284a 100644 --- a/rclcpp/include/rclcpp/node_interfaces/node_clock.hpp +++ b/rclcpp/include/rclcpp/node_interfaces/node_clock.hpp @@ -52,7 +52,7 @@ class NodeClock : public NodeClockInterface RCLCPP_PUBLIC rclcpp::Clock::SharedPtr - get_clock(); + get_clock() override; private: RCLCPP_DISABLE_COPY(NodeClock) diff --git a/rclcpp/include/rclcpp/node_interfaces/node_graph.hpp b/rclcpp/include/rclcpp/node_interfaces/node_graph.hpp index 49a1e3dc6a..ff2d91b261 100644 --- a/rclcpp/include/rclcpp/node_interfaces/node_graph.hpp +++ b/rclcpp/include/rclcpp/node_interfaces/node_graph.hpp @@ -58,64 +58,64 @@ class NodeGraph : public NodeGraphInterface RCLCPP_PUBLIC std::map> - get_topic_names_and_types(bool no_demangle = false) const; + get_topic_names_and_types(bool no_demangle = false) const override; RCLCPP_PUBLIC std::map> - get_service_names_and_types() const; + get_service_names_and_types() const override; RCLCPP_PUBLIC std::vector - get_node_names() const; + get_node_names() const override; RCLCPP_PUBLIC std::vector> - get_node_names_and_namespaces() const; + get_node_names_and_namespaces() const override; RCLCPP_PUBLIC size_t - count_publishers(const std::string & topic_name) const; + count_publishers(const std::string & topic_name) const override; RCLCPP_PUBLIC size_t - count_subscribers(const std::string & topic_name) const; + count_subscribers(const std::string & topic_name) const override; RCLCPP_PUBLIC const rcl_guard_condition_t * - get_graph_guard_condition() const; + get_graph_guard_condition() const override; RCLCPP_PUBLIC void - notify_graph_change(); + notify_graph_change() override; RCLCPP_PUBLIC void - notify_shutdown(); + notify_shutdown() override; RCLCPP_PUBLIC rclcpp::Event::SharedPtr - get_graph_event(); + get_graph_event() override; RCLCPP_PUBLIC void wait_for_graph_change( rclcpp::Event::SharedPtr event, - std::chrono::nanoseconds timeout); + std::chrono::nanoseconds timeout) override; RCLCPP_PUBLIC size_t - count_graph_users(); + count_graph_users() override; private: RCLCPP_DISABLE_COPY(NodeGraph) diff --git a/rclcpp/include/rclcpp/node_interfaces/node_logging.hpp b/rclcpp/include/rclcpp/node_interfaces/node_logging.hpp index 9b4a0ce110..17f835b0dd 100644 --- a/rclcpp/include/rclcpp/node_interfaces/node_logging.hpp +++ b/rclcpp/include/rclcpp/node_interfaces/node_logging.hpp @@ -44,12 +44,12 @@ class NodeLogging : public NodeLoggingInterface RCLCPP_PUBLIC rclcpp::Logger - get_logger() const; + get_logger() const override; RCLCPP_PUBLIC const char * - get_logger_name() const; + get_logger_name() const override; private: RCLCPP_DISABLE_COPY(NodeLogging) diff --git a/rclcpp/include/rclcpp/node_interfaces/node_services.hpp b/rclcpp/include/rclcpp/node_interfaces/node_services.hpp index 7a191b5a11..416fb32c7e 100644 --- a/rclcpp/include/rclcpp/node_interfaces/node_services.hpp +++ b/rclcpp/include/rclcpp/node_interfaces/node_services.hpp @@ -46,14 +46,14 @@ class NodeServices : public NodeServicesInterface void add_client( rclcpp::ClientBase::SharedPtr client_base_ptr, - rclcpp::callback_group::CallbackGroup::SharedPtr group); + rclcpp::callback_group::CallbackGroup::SharedPtr group) override; RCLCPP_PUBLIC void add_service( rclcpp::ServiceBase::SharedPtr service_base_ptr, - rclcpp::callback_group::CallbackGroup::SharedPtr group); + rclcpp::callback_group::CallbackGroup::SharedPtr group) override; private: RCLCPP_DISABLE_COPY(NodeServices) diff --git a/rclcpp/include/rclcpp/node_interfaces/node_timers.hpp b/rclcpp/include/rclcpp/node_interfaces/node_timers.hpp index 0cf197ddfd..27e2292dbe 100644 --- a/rclcpp/include/rclcpp/node_interfaces/node_timers.hpp +++ b/rclcpp/include/rclcpp/node_interfaces/node_timers.hpp @@ -46,7 +46,7 @@ class NodeTimers : public NodeTimersInterface void add_timer( rclcpp::TimerBase::SharedPtr timer, - rclcpp::callback_group::CallbackGroup::SharedPtr callback_group); + rclcpp::callback_group::CallbackGroup::SharedPtr callback_group) override; private: RCLCPP_DISABLE_COPY(NodeTimers) diff --git a/rclcpp/include/rclcpp/node_interfaces/node_waitables.hpp b/rclcpp/include/rclcpp/node_interfaces/node_waitables.hpp index 06e10198da..aae4a445a4 100644 --- a/rclcpp/include/rclcpp/node_interfaces/node_waitables.hpp +++ b/rclcpp/include/rclcpp/node_interfaces/node_waitables.hpp @@ -46,14 +46,14 @@ class NodeWaitables : public NodeWaitablesInterface void add_waitable( rclcpp::Waitable::SharedPtr waitable_base_ptr, - rclcpp::callback_group::CallbackGroup::SharedPtr group); + rclcpp::callback_group::CallbackGroup::SharedPtr group) override; RCLCPP_PUBLIC void remove_waitable( rclcpp::Waitable::SharedPtr waitable_ptr, - rclcpp::callback_group::CallbackGroup::SharedPtr group) noexcept; + rclcpp::callback_group::CallbackGroup::SharedPtr group) noexcept override; private: RCLCPP_DISABLE_COPY(NodeWaitables) diff --git a/rclcpp/include/rclcpp/service.hpp b/rclcpp/include/rclcpp/service.hpp index c098b0b114..eac16ad2cd 100644 --- a/rclcpp/include/rclcpp/service.hpp +++ b/rclcpp/include/rclcpp/service.hpp @@ -213,12 +213,12 @@ class Service : public ServiceBase { } - std::shared_ptr create_request() + std::shared_ptr create_request() override { return std::shared_ptr(new typename ServiceT::Request()); } - std::shared_ptr create_request_header() + std::shared_ptr create_request_header() override { // TODO(wjwwood): This should probably use rmw_request_id's allocator. // (since it is a C type) @@ -227,7 +227,7 @@ class Service : public ServiceBase void handle_request( std::shared_ptr request_header, - std::shared_ptr request) + std::shared_ptr request) override { auto typed_request = std::static_pointer_cast(request); auto response = std::shared_ptr(new typename ServiceT::Response); diff --git a/rclcpp/include/rclcpp/strategies/allocator_memory_strategy.hpp b/rclcpp/include/rclcpp/strategies/allocator_memory_strategy.hpp index 56b7f3d0fe..905b203918 100644 --- a/rclcpp/include/rclcpp/strategies/allocator_memory_strategy.hpp +++ b/rclcpp/include/rclcpp/strategies/allocator_memory_strategy.hpp @@ -61,7 +61,7 @@ class AllocatorMemoryStrategy : public memory_strategy::MemoryStrategy allocator_ = std::make_shared(); } - void add_guard_condition(const rcl_guard_condition_t * guard_condition) + void add_guard_condition(const rcl_guard_condition_t * guard_condition) override { for (const auto & existing_guard_condition : guard_conditions_) { if (existing_guard_condition == guard_condition) { @@ -71,7 +71,7 @@ class AllocatorMemoryStrategy : public memory_strategy::MemoryStrategy guard_conditions_.push_back(guard_condition); } - void remove_guard_condition(const rcl_guard_condition_t * guard_condition) + void remove_guard_condition(const rcl_guard_condition_t * guard_condition) override { for (auto it = guard_conditions_.begin(); it != guard_conditions_.end(); ++it) { if (*it == guard_condition) { @@ -81,7 +81,7 @@ class AllocatorMemoryStrategy : public memory_strategy::MemoryStrategy } } - void clear_handles() + void clear_handles() override { subscription_handles_.clear(); service_handles_.clear(); @@ -90,7 +90,7 @@ class AllocatorMemoryStrategy : public memory_strategy::MemoryStrategy waitable_handles_.clear(); } - void remove_null_handles(rcl_wait_set_t * wait_set) + void remove_null_handles(rcl_wait_set_t * wait_set) override { // TODO(jacobperron): Check if wait set sizes are what we expect them to be? // e.g. wait_set->size_of_clients == client_handles_.size() @@ -150,7 +150,7 @@ class AllocatorMemoryStrategy : public memory_strategy::MemoryStrategy ); } - bool collect_entities(const WeakNodeList & weak_nodes) + bool collect_entities(const WeakNodeList & weak_nodes) override { bool has_invalid_weak_nodes = false; for (auto & weak_node : weak_nodes) { @@ -191,7 +191,7 @@ class AllocatorMemoryStrategy : public memory_strategy::MemoryStrategy return has_invalid_weak_nodes; } - bool add_handles_to_wait_set(rcl_wait_set_t * wait_set) + bool add_handles_to_wait_set(rcl_wait_set_t * wait_set) override { for (auto subscription : subscription_handles_) { if (rcl_wait_set_add_subscription(wait_set, subscription.get(), NULL) != RCL_RET_OK) { @@ -253,7 +253,7 @@ class AllocatorMemoryStrategy : public memory_strategy::MemoryStrategy void get_next_subscription( executor::AnyExecutable & any_exec, - const WeakNodeList & weak_nodes) + const WeakNodeList & weak_nodes) override { auto it = subscription_handles_.begin(); while (it != subscription_handles_.end()) { @@ -288,7 +288,7 @@ class AllocatorMemoryStrategy : public memory_strategy::MemoryStrategy void get_next_service( executor::AnyExecutable & any_exec, - const WeakNodeList & weak_nodes) + const WeakNodeList & weak_nodes) override { auto it = service_handles_.begin(); while (it != service_handles_.end()) { @@ -321,7 +321,7 @@ class AllocatorMemoryStrategy : public memory_strategy::MemoryStrategy } void - get_next_client(executor::AnyExecutable & any_exec, const WeakNodeList & weak_nodes) + get_next_client(executor::AnyExecutable & any_exec, const WeakNodeList & weak_nodes) override { auto it = client_handles_.begin(); while (it != client_handles_.end()) { @@ -356,7 +356,7 @@ class AllocatorMemoryStrategy : public memory_strategy::MemoryStrategy void get_next_timer( executor::AnyExecutable & any_exec, - const WeakNodeList & weak_nodes) + const WeakNodeList & weak_nodes) override { auto it = timer_handles_.begin(); while (it != timer_handles_.end()) { @@ -389,7 +389,7 @@ class AllocatorMemoryStrategy : public memory_strategy::MemoryStrategy } void - get_next_waitable(executor::AnyExecutable & any_exec, const WeakNodeList & weak_nodes) + get_next_waitable(executor::AnyExecutable & any_exec, const WeakNodeList & weak_nodes) override { auto it = waitable_handles_.begin(); while (it != waitable_handles_.end()) { @@ -421,12 +421,12 @@ class AllocatorMemoryStrategy : public memory_strategy::MemoryStrategy } } - rcl_allocator_t get_allocator() + rcl_allocator_t get_allocator() override { return rclcpp::allocator::get_rcl_allocator(*allocator_.get()); } - size_t number_of_ready_subscriptions() const + size_t number_of_ready_subscriptions() const override { size_t number_of_subscriptions = subscription_handles_.size(); for (auto waitable : waitable_handles_) { @@ -435,7 +435,7 @@ class AllocatorMemoryStrategy : public memory_strategy::MemoryStrategy return number_of_subscriptions; } - size_t number_of_ready_services() const + size_t number_of_ready_services() const override { size_t number_of_services = service_handles_.size(); for (auto waitable : waitable_handles_) { @@ -444,7 +444,7 @@ class AllocatorMemoryStrategy : public memory_strategy::MemoryStrategy return number_of_services; } - size_t number_of_ready_events() const + size_t number_of_ready_events() const override { size_t number_of_events = 0; for (auto waitable : waitable_handles_) { @@ -453,7 +453,7 @@ class AllocatorMemoryStrategy : public memory_strategy::MemoryStrategy return number_of_events; } - size_t number_of_ready_clients() const + size_t number_of_ready_clients() const override { size_t number_of_clients = client_handles_.size(); for (auto waitable : waitable_handles_) { @@ -462,7 +462,7 @@ class AllocatorMemoryStrategy : public memory_strategy::MemoryStrategy return number_of_clients; } - size_t number_of_guard_conditions() const + size_t number_of_guard_conditions() const override { size_t number_of_guard_conditions = guard_conditions_.size(); for (auto waitable : waitable_handles_) { @@ -471,7 +471,7 @@ class AllocatorMemoryStrategy : public memory_strategy::MemoryStrategy return number_of_guard_conditions; } - size_t number_of_ready_timers() const + size_t number_of_ready_timers() const override { size_t number_of_timers = timer_handles_.size(); for (auto waitable : waitable_handles_) { @@ -480,7 +480,7 @@ class AllocatorMemoryStrategy : public memory_strategy::MemoryStrategy return number_of_timers; } - size_t number_of_waitables() const + size_t number_of_waitables() const override { return waitable_handles_.size(); }