From 0f58e2974393a6fb4292585efcb2db10d9b10584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Hern=C3=A1ndez=20Cordero?= Date: Mon, 25 Nov 2024 14:08:10 +0100 Subject: [PATCH] make linters happy MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alejandro Hernández Cordero --- .../src/detail/attachment_helpers.cpp | 6 ++-- .../src/detail/attachment_helpers.hpp | 3 ++ rmw_zenoh_cpp/src/detail/liveliness_utils.cpp | 4 +-- rmw_zenoh_cpp/src/detail/liveliness_utils.hpp | 4 +-- rmw_zenoh_cpp/src/detail/rmw_client_data.cpp | 5 +-- rmw_zenoh_cpp/src/detail/rmw_client_data.hpp | 4 +-- .../src/detail/rmw_context_impl_s.cpp | 17 ++++------ .../src/detail/rmw_context_impl_s.hpp | 4 +-- rmw_zenoh_cpp/src/detail/rmw_node_data.hpp | 4 +-- .../src/detail/rmw_publisher_data.cpp | 2 +- .../src/detail/rmw_publisher_data.hpp | 4 +-- rmw_zenoh_cpp/src/detail/rmw_service_data.cpp | 4 ++- rmw_zenoh_cpp/src/detail/rmw_service_data.hpp | 4 +-- .../src/detail/rmw_subscription_data.cpp | 2 -- .../src/detail/rmw_subscription_data.hpp | 4 +-- rmw_zenoh_cpp/src/detail/shm_context.hpp | 34 ------------------- rmw_zenoh_cpp/src/detail/zenoh_config.hpp | 3 +- rmw_zenoh_cpp/src/detail/zenoh_utils.cpp | 1 + rmw_zenoh_cpp/src/rmw_init.cpp | 4 +-- rmw_zenoh_cpp/src/rmw_init_options.cpp | 3 +- rmw_zenoh_cpp/src/rmw_zenoh.cpp | 3 +- 21 files changed, 45 insertions(+), 74 deletions(-) delete mode 100644 rmw_zenoh_cpp/src/detail/shm_context.hpp diff --git a/rmw_zenoh_cpp/src/detail/attachment_helpers.cpp b/rmw_zenoh_cpp/src/detail/attachment_helpers.cpp index 62fda915..d83220fb 100644 --- a/rmw_zenoh_cpp/src/detail/attachment_helpers.cpp +++ b/rmw_zenoh_cpp/src/detail/attachment_helpers.cpp @@ -12,13 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include #include #include +#include #include #include +#include + +#include #include "rmw/types.h" diff --git a/rmw_zenoh_cpp/src/detail/attachment_helpers.hpp b/rmw_zenoh_cpp/src/detail/attachment_helpers.hpp index 7d5e218c..688e80cc 100644 --- a/rmw_zenoh_cpp/src/detail/attachment_helpers.hpp +++ b/rmw_zenoh_cpp/src/detail/attachment_helpers.hpp @@ -15,6 +15,9 @@ #ifndef DETAIL__ATTACHMENT_HELPERS_HPP_ #define DETAIL__ATTACHMENT_HELPERS_HPP_ +#include +#include + #include #include "rmw/types.h" diff --git a/rmw_zenoh_cpp/src/detail/liveliness_utils.cpp b/rmw_zenoh_cpp/src/detail/liveliness_utils.cpp index 34cff1d5..9067ded0 100644 --- a/rmw_zenoh_cpp/src/detail/liveliness_utils.cpp +++ b/rmw_zenoh_cpp/src/detail/liveliness_utils.cpp @@ -14,8 +14,6 @@ #include "liveliness_utils.hpp" -#include - #include #include #include @@ -27,6 +25,8 @@ #include #include +#include + #include "logging_macros.hpp" #include "qos.hpp" #include "simplified_xxhash3.hpp" diff --git a/rmw_zenoh_cpp/src/detail/liveliness_utils.hpp b/rmw_zenoh_cpp/src/detail/liveliness_utils.hpp index 82124f9e..1c586057 100644 --- a/rmw_zenoh_cpp/src/detail/liveliness_utils.hpp +++ b/rmw_zenoh_cpp/src/detail/liveliness_utils.hpp @@ -15,8 +15,6 @@ #ifndef DETAIL__LIVELINESS_UTILS_HPP_ #define DETAIL__LIVELINESS_UTILS_HPP_ -#include - #include #include #include @@ -24,6 +22,8 @@ #include #include +#include + #include "rmw/types.h" namespace rmw_zenoh_cpp diff --git a/rmw_zenoh_cpp/src/detail/rmw_client_data.cpp b/rmw_zenoh_cpp/src/detail/rmw_client_data.cpp index 9accc6ff..f57203fb 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_client_data.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_client_data.cpp @@ -15,7 +15,6 @@ #include "rmw_client_data.hpp" #include -#include #include #include @@ -23,6 +22,9 @@ #include #include #include +#include + +#include #include "cdr.hpp" #include "liveliness_utils.hpp" @@ -387,7 +389,6 @@ rmw_ret_t ClientData::send_request( keyexpr_.value(), parameters, [client_data](const zenoh::Reply & reply) { - if (!reply.is_ok()) { RMW_ZENOH_LOG_ERROR_NAMED( "rmw_zenoh_cpp", diff --git a/rmw_zenoh_cpp/src/detail/rmw_client_data.hpp b/rmw_zenoh_cpp/src/detail/rmw_client_data.hpp index b8a387d7..2a56bf56 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_client_data.hpp +++ b/rmw_zenoh_cpp/src/detail/rmw_client_data.hpp @@ -15,8 +15,6 @@ #ifndef DETAIL__RMW_CLIENT_DATA_HPP_ #define DETAIL__RMW_CLIENT_DATA_HPP_ -#include - #include #include #include @@ -24,6 +22,8 @@ #include #include +#include + #include "event.hpp" #include "liveliness_utils.hpp" #include "service_type_support.hpp" diff --git a/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp b/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp index c1c61ad3..52867e8e 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp @@ -13,7 +13,6 @@ // limitations under the License. #include "rmw_context_impl_s.hpp" -#include #include #include @@ -26,6 +25,8 @@ #include #include +#include + #include "graph_cache.hpp" #include "guard_condition.hpp" #include "identifier.hpp" @@ -153,10 +154,9 @@ class rmw_context_impl_s::Data final // the code will be simpler, and if we're just going to spin over the non-blocking // reads until we obtain responses, we'll just be hogging CPU time by convincing // the OS that we're doing actual work when it could instead park the thread. - // z_owned_fifo_handler_reply_t handler; - // z_owned_closure_reply_t closure; - // z_fifo_channel_reply_new(&closure, &handler, SIZE_MAX - 1); - // Intuitively use a FIFO channel rather than building it up with a closure and a handler to FIFO channel + + // Intuitively use a FIFO channel rather than building it up with a closure and a + // handler to FIFO channel zenoh::KeyExpr keyexpr(liveliness_str); zenoh::Session::GetOptions options = zenoh::Session::GetOptions::create_default(); @@ -177,7 +177,6 @@ class rmw_context_impl_s::Data final for (auto res = replies.recv(); std::holds_alternative(res); res = replies.recv()) { - const zenoh::Reply & reply = std::get(res); if (reply.is_ok()) { const auto & sample = reply.get_ok(); @@ -195,7 +194,6 @@ class rmw_context_impl_s::Data final throw std::runtime_error("Unable to create shm provider."); } shm_provider_ = std::move(provider); - } graph_guard_condition_ = std::make_unique(); @@ -211,9 +209,8 @@ class rmw_context_impl_s::Data final graph_subscriber_cpp_ = session_->liveliness_declare_subscriber( keyexpr_cpp, [&](const zenoh::Sample & sample) { - - // // Look up the data shared_ptr in the global map. If it is in there, use it. - // If not, it is being shutdown so we can just ignore this update. + // Look up the data shared_ptr in the global map. If it is in there, use it. + // If not, it is being shutdown so we can just ignore this update. std::shared_ptr data_shared_ptr{nullptr}; { std::lock_guard lk(data_to_data_shared_ptr_map_mutex); diff --git a/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.hpp b/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.hpp index 0a54dd23..a74fab85 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.hpp +++ b/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.hpp @@ -15,13 +15,13 @@ #ifndef DETAIL__RMW_CONTEXT_IMPL_S_HPP_ #define DETAIL__RMW_CONTEXT_IMPL_S_HPP_ -#include - #include #include #include #include +#include + #include "graph_cache.hpp" #include "rmw_node_data.hpp" diff --git a/rmw_zenoh_cpp/src/detail/rmw_node_data.hpp b/rmw_zenoh_cpp/src/detail/rmw_node_data.hpp index 97e8ed0a..d88da1f8 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_node_data.hpp +++ b/rmw_zenoh_cpp/src/detail/rmw_node_data.hpp @@ -15,14 +15,14 @@ #ifndef DETAIL__RMW_NODE_DATA_HPP_ #define DETAIL__RMW_NODE_DATA_HPP_ -#include - #include #include #include #include #include +#include + #include "graph_cache.hpp" #include "liveliness_utils.hpp" #include "rmw_client_data.hpp" diff --git a/rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp b/rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp index bd8bad8a..1d41c46a 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include "cdr.hpp" #include "message_type_support.hpp" @@ -104,7 +105,6 @@ std::shared_ptr PublisherData::make( zenoh::KeyExpr pub_ke(entity->topic_info()->topic_keyexpr_); // Create a Publication Cache if durability is transient_local. if (adapted_qos_profile.durability == RMW_QOS_POLICY_DURABILITY_TRANSIENT_LOCAL) { - zenoh::Session::PublicationCacheOptions pub_cache_opts = zenoh::Session::PublicationCacheOptions::create_default(); diff --git a/rmw_zenoh_cpp/src/detail/rmw_publisher_data.hpp b/rmw_zenoh_cpp/src/detail/rmw_publisher_data.hpp index 4f6a2511..fa80b338 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_publisher_data.hpp +++ b/rmw_zenoh_cpp/src/detail/rmw_publisher_data.hpp @@ -15,8 +15,6 @@ #ifndef DETAIL__RMW_PUBLISHER_DATA_HPP_ #define DETAIL__RMW_PUBLISHER_DATA_HPP_ -#include - #include #include #include @@ -24,6 +22,8 @@ #include #include +#include + #include "event.hpp" #include "liveliness_utils.hpp" #include "message_type_support.hpp" diff --git a/rmw_zenoh_cpp/src/detail/rmw_service_data.cpp b/rmw_zenoh_cpp/src/detail/rmw_service_data.cpp index fc02e9ae..a5cd078e 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_service_data.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_service_data.cpp @@ -15,13 +15,15 @@ #include "rmw_service_data.hpp" #include -#include #include #include #include #include #include +#include + +#include #include "attachment_helpers.hpp" #include "cdr.hpp" diff --git a/rmw_zenoh_cpp/src/detail/rmw_service_data.hpp b/rmw_zenoh_cpp/src/detail/rmw_service_data.hpp index 4d7a6e64..39cd2eaa 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_service_data.hpp +++ b/rmw_zenoh_cpp/src/detail/rmw_service_data.hpp @@ -15,8 +15,6 @@ #ifndef DETAIL__RMW_SERVICE_DATA_HPP_ #define DETAIL__RMW_SERVICE_DATA_HPP_ -#include - #include #include #include @@ -25,6 +23,8 @@ #include #include +#include + #include "event.hpp" #include "liveliness_utils.hpp" #include "service_type_support.hpp" diff --git a/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp b/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp index 14f92c69..895501c8 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp @@ -286,7 +286,6 @@ bool SubscriptionData::init() zenoh::Subscriber sub = context_impl->session()->declare_subscriber( sub_ke, [data_wp](const zenoh::Sample & sample) { - zenoh::KeyExpr keystr(std::string(sample.get_keyexpr().as_string_view())); auto sub_data = data_wp.lock(); @@ -426,7 +425,6 @@ rmw_ret_t SubscriptionData::shutdown() return RMW_RET_ERROR; } } - } } diff --git a/rmw_zenoh_cpp/src/detail/rmw_subscription_data.hpp b/rmw_zenoh_cpp/src/detail/rmw_subscription_data.hpp index 0e810b05..5ad10898 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_subscription_data.hpp +++ b/rmw_zenoh_cpp/src/detail/rmw_subscription_data.hpp @@ -15,8 +15,6 @@ #ifndef DETAIL__RMW_SUBSCRIPTION_DATA_HPP_ #define DETAIL__RMW_SUBSCRIPTION_DATA_HPP_ -#include - #include #include #include @@ -28,6 +26,8 @@ #include #include +#include + #include "event.hpp" #include "graph_cache.hpp" #include "liveliness_utils.hpp" diff --git a/rmw_zenoh_cpp/src/detail/shm_context.hpp b/rmw_zenoh_cpp/src/detail/shm_context.hpp deleted file mode 100644 index 0611f623..00000000 --- a/rmw_zenoh_cpp/src/detail/shm_context.hpp +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2023 Open Source Robotics Foundation, Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#ifndef DETAIL__SHM_CONTEXT_HPP_ -#define DETAIL__SHM_CONTEXT_HPP_ - -#include - -namespace rmw_zenoh_cpp -{ -///============================================================================= -#ifdef RMW_ZENOH_BUILD_WITH_SHARED_MEMORY -struct ShmContext -{ - z_owned_shm_provider_t shm_provider; - size_t msgsize_threshold; - - ~ShmContext(); -}; -#endif -} // namespace rmw_zenoh_cpp - -#endif // DETAIL__SHM_CONTEXT_HPP_ diff --git a/rmw_zenoh_cpp/src/detail/zenoh_config.hpp b/rmw_zenoh_cpp/src/detail/zenoh_config.hpp index fb07be92..276eaea8 100644 --- a/rmw_zenoh_cpp/src/detail/zenoh_config.hpp +++ b/rmw_zenoh_cpp/src/detail/zenoh_config.hpp @@ -15,9 +15,10 @@ #ifndef DETAIL__ZENOH_CONFIG_HPP_ #define DETAIL__ZENOH_CONFIG_HPP_ +#include + #include #include -#include #include "rmw/ret_types.h" diff --git a/rmw_zenoh_cpp/src/detail/zenoh_utils.cpp b/rmw_zenoh_cpp/src/detail/zenoh_utils.cpp index 13d29b44..3a932853 100644 --- a/rmw_zenoh_cpp/src/detail/zenoh_utils.cpp +++ b/rmw_zenoh_cpp/src/detail/zenoh_utils.cpp @@ -15,6 +15,7 @@ #include "zenoh_utils.hpp" #include +#include #include "attachment_helpers.hpp" #include "rmw/types.h" diff --git a/rmw_zenoh_cpp/src/rmw_init.cpp b/rmw_zenoh_cpp/src/rmw_init.cpp index e57720fa..57979eba 100644 --- a/rmw_zenoh_cpp/src/rmw_init.cpp +++ b/rmw_zenoh_cpp/src/rmw_init.cpp @@ -12,10 +12,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include - #include +#include + #include "detail/identifier.hpp" #include "detail/rmw_context_impl_s.hpp" #include "detail/zenoh_config.hpp" diff --git a/rmw_zenoh_cpp/src/rmw_init_options.cpp b/rmw_zenoh_cpp/src/rmw_init_options.cpp index b5242035..58666b54 100644 --- a/rmw_zenoh_cpp/src/rmw_init_options.cpp +++ b/rmw_zenoh_cpp/src/rmw_init_options.cpp @@ -12,8 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include -#include +#include #include "detail/identifier.hpp" diff --git a/rmw_zenoh_cpp/src/rmw_zenoh.cpp b/rmw_zenoh_cpp/src/rmw_zenoh.cpp index d1d2fb63..f0c3125d 100644 --- a/rmw_zenoh_cpp/src/rmw_zenoh.cpp +++ b/rmw_zenoh_cpp/src/rmw_zenoh.cpp @@ -14,7 +14,6 @@ #include #include -#include #include #include @@ -23,6 +22,8 @@ #include #include +#include + #include "detail/cdr.hpp" #include "detail/guard_condition.hpp" #include "detail/identifier.hpp"