From 0dffa4927c686f08d729619df5fb81ce19850d92 Mon Sep 17 00:00:00 2001 From: Mahmoud Mazouz Date: Wed, 27 Nov 2024 12:38:48 +0100 Subject: [PATCH 1/6] Fix `z_view_string_t` to `std::string` conversion (#45) * Fix `z_view_string_t` to `std::string` conversion * Fix formatting --- rmw_zenoh_cpp/src/detail/rmw_service_data.cpp | 5 +++-- rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp | 4 +++- rmw_zenoh_cpp/src/detail/zenoh_utils.cpp | 5 ++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/rmw_zenoh_cpp/src/detail/rmw_service_data.cpp b/rmw_zenoh_cpp/src/detail/rmw_service_data.cpp index b51b3973..7eab62d9 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_service_data.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_service_data.cpp @@ -46,8 +46,9 @@ void service_data_handler(z_loaned_query_t * query, void * data) RMW_ZENOH_LOG_ERROR_NAMED( "rmw_zenoh_cpp", "Unable to obtain ServiceData from data for " - "service for %s", - z_loan(keystr) + "service for %.*s", + static_cast(z_string_len(z_loan(keystr))), + z_string_data(z_loan(keystr)) ); return; } diff --git a/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp b/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp index 614288f6..ed0a97fc 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp @@ -65,12 +65,14 @@ void sub_data_handler(z_loaned_sample_t * sample, void * data) z_owned_slice_t slice; z_bytes_to_slice(payload, &slice); + std::string topic_name(z_string_data(z_loan(keystr)), z_string_len(z_loan(keystr))); + sub_data->add_new_message( std::make_unique( slice, z_timestamp_ntp64_time(z_sample_timestamp(sample)), std::move(attachment)), - z_string_data(z_loan(keystr))); + &topic_name); } } // namespace diff --git a/rmw_zenoh_cpp/src/detail/zenoh_utils.cpp b/rmw_zenoh_cpp/src/detail/zenoh_utils.cpp index 74cf1668..d6f7770c 100644 --- a/rmw_zenoh_cpp/src/detail/zenoh_utils.cpp +++ b/rmw_zenoh_cpp/src/detail/zenoh_utils.cpp @@ -34,7 +34,10 @@ void create_map_and_set_sequence_num( } ///============================================================================= -ZenohQuery::ZenohQuery(const z_loaned_query_t * query, std::chrono::nanoseconds::rep received_timestamp) { +ZenohQuery::ZenohQuery( + const z_loaned_query_t * query, + std::chrono::nanoseconds::rep received_timestamp) +{ z_query_clone(&query_, query); received_timestamp_ = received_timestamp; } From 91df63c855f1df63e527800ec4e2e31f166b130b Mon Sep 17 00:00:00 2001 From: yuanyuyuan Date: Thu, 28 Nov 2024 15:16:16 +0800 Subject: [PATCH 2/6] fix: address the comments --- rmw_zenoh_cpp/src/detail/graph_cache.cpp | 7 ++-- .../src/detail/rmw_context_impl_s.cpp | 16 ++++----- rmw_zenoh_cpp/src/detail/shm_context.hpp | 34 ------------------- rmw_zenoh_cpp/src/detail/zenoh_config.cpp | 1 - rmw_zenoh_cpp/src/detail/zenoh_config.hpp | 1 + rmw_zenoh_cpp/src/rmw_zenoh.cpp | 6 +--- rmw_zenoh_cpp/src/zenohd/main.cpp | 2 +- 7 files changed, 13 insertions(+), 54 deletions(-) delete mode 100644 rmw_zenoh_cpp/src/detail/shm_context.hpp diff --git a/rmw_zenoh_cpp/src/detail/graph_cache.cpp b/rmw_zenoh_cpp/src/detail/graph_cache.cpp index c60256ff..fedcd03f 100644 --- a/rmw_zenoh_cpp/src/detail/graph_cache.cpp +++ b/rmw_zenoh_cpp/src/detail/graph_cache.cpp @@ -611,10 +611,9 @@ void GraphCache::parse_del( if (entity->type() == EntityType::Node) { // Node - // In case the remote Node closed abruptly or was disconnected, Zenoh could deliver the - // liveliness tokens unregistration events in any order. - // If the event for Node unregistration comes before the unregistration of its - // pubs/subs/services, we should update the count in graph_topics_ and graph_services_. + // When destroying a node, Zenoh does not guarantee that liveliness tokens to remove pub/subs + // arrive before the one to remove the node from the graph despite un-registering those entities earlier. + // In such scenarios, if we find any pub/subs present in the node, we reduce their counts in graph_topics_. const GraphNodePtr graph_node = node_it->second; if (!graph_node->pubs_.empty() || !graph_node->subs_.empty() || 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 94dcd070..12a7374e 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp @@ -97,7 +97,7 @@ class rmw_context_impl_s::Data final // Initialize the zenoh session. if (z_open(&session_, z_move(config), NULL) != Z_OK) { - RMW_SET_ERROR_MSG("Error setting up zenoh session"); + RMW_SET_ERROR_MSG("Error setting up zenoh session."); throw std::runtime_error("Error setting up zenoh session."); } atexit(update_is_exiting); @@ -155,23 +155,21 @@ class rmw_context_impl_s::Data final z_owned_closure_reply_t closure; z_fifo_channel_reply_new(&closure, &handler, SIZE_MAX - 1); - z_view_keyexpr_t keyexpr; z_view_keyexpr_from_str(&keyexpr, liveliness_str.c_str()); zc_liveliness_get( z_loan(session_), z_loan(keyexpr), z_move(closure), NULL); - z_owned_reply_t reply; while (z_recv(z_loan(handler), &reply) == Z_OK) { if (z_reply_is_ok(z_loan(reply))) { const z_loaned_sample_t * sample = z_reply_ok(z_loan(reply)); z_view_string_t keystr; z_keyexpr_as_view_string(z_sample_keyexpr(sample), &keystr); - std::string str(z_string_data(z_loan(keystr)), z_string_len(z_loan(keystr))); + std::string livelines_str(z_string_data(z_loan(keystr)), z_string_len(z_loan(keystr))); // Ignore tokens from the same session to avoid race conditions from this // query and the liveliness subscription. - graph_cache_->parse_put(str, true); + graph_cache_->parse_put(std::move(livelines_str), true); } else { RMW_ZENOH_LOG_DEBUG_NAMED( "rmw_zenoh_cpp", "[rmw_context_impl_s] z_call received an invalid reply.\n"); @@ -194,8 +192,8 @@ class rmw_context_impl_s::Data final z_owned_shm_provider_t provider; if (z_posix_shm_provider_new(&provider, z_loan(layout)) != Z_OK) { - RMW_ZENOH_LOG_ERROR_NAMED("rmw_zenoh_cpp", "Unable to create a SHM provider."); - throw std::runtime_error("Unable to create shm provider."); + RMW_ZENOH_LOG_ERROR_NAMED("rmw_zenoh_cpp", "Unable to create an SHM provider."); + throw std::runtime_error("Unable to create an SHM provider."); } shm_provider_ = provider; } @@ -462,8 +460,8 @@ static void graph_sub_data_handler(z_loaned_sample_t * sample, void * data) } // Update the graph cache. - std::string str(z_string_data(z_loan(keystr)), z_string_len(z_loan(keystr))); - data_shared_ptr->update_graph_cache(z_sample_kind(sample), str); + std::string livelines_str(z_string_data(z_loan(keystr)), z_string_len(z_loan(keystr))); + data_shared_ptr->update_graph_cache(z_sample_kind(sample), std::move(livelines_str)); } ///============================================================================= 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.cpp b/rmw_zenoh_cpp/src/detail/zenoh_config.cpp index 1a38a340..71e7bc43 100644 --- a/rmw_zenoh_cpp/src/detail/zenoh_config.cpp +++ b/rmw_zenoh_cpp/src/detail/zenoh_config.cpp @@ -61,7 +61,6 @@ rmw_ret_t _get_z_config( // If the environment variable is set, try to read the configuration from the file, // if the environment variable is not set use internal configuration configured_uri = envar_uri[0] != '\0' ? envar_uri : default_uri; - // Try to read the configuration if (zc_config_from_file(config, configured_uri) != Z_OK) { RMW_ZENOH_LOG_ERROR_NAMED( diff --git a/rmw_zenoh_cpp/src/detail/zenoh_config.hpp b/rmw_zenoh_cpp/src/detail/zenoh_config.hpp index 357c7e89..e07ca233 100644 --- a/rmw_zenoh_cpp/src/detail/zenoh_config.hpp +++ b/rmw_zenoh_cpp/src/detail/zenoh_config.hpp @@ -16,6 +16,7 @@ #define DETAIL__ZENOH_CONFIG_HPP_ #include + #include #include "rmw/ret_types.h" diff --git a/rmw_zenoh_cpp/src/rmw_zenoh.cpp b/rmw_zenoh_cpp/src/rmw_zenoh.cpp index d1d2fb63..fbe747a8 100644 --- a/rmw_zenoh_cpp/src/rmw_zenoh.cpp +++ b/rmw_zenoh_cpp/src/rmw_zenoh.cpp @@ -104,9 +104,6 @@ const rosidl_service_type_support_t * find_service_type_support( extern "C" { -// TODO(yuyuan): SHM, make this configurable -#define SHM_BUF_OK_SIZE 2621440 - //============================================================================== /// Get the name of the rmw implementation being used const char * @@ -446,8 +443,7 @@ rmw_create_publisher( } //============================================================================== -/// Finalize a given publisher handle, reclaim the resources, and deallocate the -/// publisher handle. +/// Finalize a given publisher handle, reclaim the resources, and deallocate the publisher handle. rmw_ret_t rmw_destroy_publisher(rmw_node_t * node, rmw_publisher_t * publisher) { diff --git a/rmw_zenoh_cpp/src/zenohd/main.cpp b/rmw_zenoh_cpp/src/zenohd/main.cpp index f55c3b3a..ce73fc14 100644 --- a/rmw_zenoh_cpp/src/zenohd/main.cpp +++ b/rmw_zenoh_cpp/src/zenohd/main.cpp @@ -68,7 +68,7 @@ int main(int argc, char ** argv) return 1; } - // Enable the zenoh built-in logger + // Enable the zenoh built-in logger. zc_try_init_log_from_env(); // Initialize the zenoh configuration for the router. From 70990e79e39f1a9ca50d2c0a188ab90bf130735f Mon Sep 17 00:00:00 2001 From: yuanyuyuan Date: Thu, 28 Nov 2024 15:19:29 +0800 Subject: [PATCH 3/6] style: ament_cpplint --- rmw_zenoh_cpp/src/detail/graph_cache.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rmw_zenoh_cpp/src/detail/graph_cache.cpp b/rmw_zenoh_cpp/src/detail/graph_cache.cpp index fedcd03f..f1788423 100644 --- a/rmw_zenoh_cpp/src/detail/graph_cache.cpp +++ b/rmw_zenoh_cpp/src/detail/graph_cache.cpp @@ -612,8 +612,9 @@ void GraphCache::parse_del( if (entity->type() == EntityType::Node) { // Node // When destroying a node, Zenoh does not guarantee that liveliness tokens to remove pub/subs - // arrive before the one to remove the node from the graph despite un-registering those entities earlier. - // In such scenarios, if we find any pub/subs present in the node, we reduce their counts in graph_topics_. + // arrive before the one to remove the node from the graph despite un-registering those entities + // earlier. In such scenarios, if we find any pub/subs present in the node, we reduce their + // counts in graph_topics_. const GraphNodePtr graph_node = node_it->second; if (!graph_node->pubs_.empty() || !graph_node->subs_.empty() || From 33f0becd61f6fdb456c5c2ecabf2d2cda463506b Mon Sep 17 00:00:00 2001 From: yuanyuyuan Date: Thu, 28 Nov 2024 15:26:05 +0800 Subject: [PATCH 4/6] refactor: remove the workaround for the atexit shutdown --- .../src/detail/rmw_context_impl_s.cpp | 29 ++++--------------- 1 file changed, 6 insertions(+), 23 deletions(-) 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 12a7374e..7915cd9e 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp @@ -13,8 +13,8 @@ // limitations under the License. #include "rmw_context_impl_s.hpp" -#include +#include #include #include #include @@ -41,16 +41,6 @@ // TODO(clalancette): Make this configurable, or get it from the configuration #define SHM_BUFFER_SIZE_MB 10 -// The variable is used to identify whether the process is trying to exit or not. -// The atexit function we registered will set the flag and prevent us from closing -// Zenoh Session. Zenoh API can't be used in atexit function, because Tokio context -// is already destroyed. It will cause panic if we do so. -static bool is_exiting = false; -void update_is_exiting() -{ - is_exiting = true; -} - // This global mapping of raw Data pointers to Data shared pointers allows graph_sub_data_handler() // to lookup the pointer, and gain a reference to a shared_ptr if it exists. // This guarantees that the Data object will not be destroyed while we are using it. @@ -100,13 +90,9 @@ class rmw_context_impl_s::Data final RMW_SET_ERROR_MSG("Error setting up zenoh session."); throw std::runtime_error("Error setting up zenoh session."); } - atexit(update_is_exiting); auto close_session = rcpputils::make_scope_exit( [this]() { - // Don't touch Zenoh Session if the ROS process is exiting, it will cause panic. - if (!is_exiting) { - z_close(z_loan_mut(session_), NULL); - } + z_close(z_loan_mut(session_), NULL); }); // Verify if the zenoh router is running if configured. @@ -254,13 +240,10 @@ class rmw_context_impl_s::Data final // to avoid an AB/BA deadlock if shutdown is racing with graph_sub_data_handler(). } - // Don't touch Zenoh Session if the ROS process is exiting, it will cause panic. - if (!is_exiting) { - // Close the zenoh session - if (z_close(z_loan_mut(session_), NULL) != Z_OK) { - RMW_SET_ERROR_MSG("Error while closing zenoh session"); - return RMW_RET_ERROR; - } + // Close the zenoh session + if (z_close(z_loan_mut(session_), NULL) != Z_OK) { + RMW_SET_ERROR_MSG("Error while closing zenoh session"); + return RMW_RET_ERROR; } return RMW_RET_OK; } From b8ce65cd33bdf92b4e7ae99e5f7196ffcd30c575 Mon Sep 17 00:00:00 2001 From: yuanyuyuan Date: Thu, 28 Nov 2024 15:26:24 +0800 Subject: [PATCH 5/6] fix: correct the call by ref --- rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp b/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp index ed0a97fc..68c86c60 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp @@ -72,7 +72,7 @@ void sub_data_handler(z_loaned_sample_t * sample, void * data) slice, z_timestamp_ntp64_time(z_sample_timestamp(sample)), std::move(attachment)), - &topic_name); + topic_name); } } // namespace From 435186ad7a867416510f124f9b62224b72e50524 Mon Sep 17 00:00:00 2001 From: yuanyuyuan Date: Thu, 28 Nov 2024 15:47:11 +0800 Subject: [PATCH 6/6] refactor: revert the header clean --- rmw_zenoh_cpp/src/detail/graph_cache.cpp | 1 + rmw_zenoh_cpp/src/detail/graph_cache.hpp | 6 ++++-- rmw_zenoh_cpp/src/detail/liveliness_utils.cpp | 5 +++-- rmw_zenoh_cpp/src/detail/liveliness_utils.hpp | 1 + rmw_zenoh_cpp/src/detail/rmw_client_data.cpp | 9 ++++++++- rmw_zenoh_cpp/src/detail/rmw_client_data.hpp | 7 +++++++ rmw_zenoh_cpp/src/detail/rmw_node_data.hpp | 2 ++ rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp | 3 +++ rmw_zenoh_cpp/src/detail/rmw_publisher_data.hpp | 4 ++++ rmw_zenoh_cpp/src/detail/rmw_service_data.cpp | 6 +++++- rmw_zenoh_cpp/src/detail/rmw_service_data.hpp | 6 ++++++ .../src/detail/rmw_subscription_data.cpp | 5 +++-- rmw_zenoh_cpp/src/detail/type_support.cpp | 2 ++ rmw_zenoh_cpp/src/detail/zenoh_config.cpp | 2 -- rmw_zenoh_cpp/src/detail/zenoh_config.hpp | 2 ++ rmw_zenoh_cpp/src/detail/zenoh_router_check.cpp | 2 ++ rmw_zenoh_cpp/src/detail/zenoh_utils.cpp | 5 ++++- rmw_zenoh_cpp/src/detail/zenoh_utils.hpp | 1 + rmw_zenoh_cpp/src/rmw_event.cpp | 1 + rmw_zenoh_cpp/src/rmw_init.cpp | 8 ++++++++ rmw_zenoh_cpp/src/rmw_init_options.cpp | 2 ++ rmw_zenoh_cpp/src/rmw_zenoh.cpp | 16 +++++++++++++--- 22 files changed, 82 insertions(+), 14 deletions(-) diff --git a/rmw_zenoh_cpp/src/detail/graph_cache.cpp b/rmw_zenoh_cpp/src/detail/graph_cache.cpp index f1788423..b622e06d 100644 --- a/rmw_zenoh_cpp/src/detail/graph_cache.cpp +++ b/rmw_zenoh_cpp/src/detail/graph_cache.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include diff --git a/rmw_zenoh_cpp/src/detail/graph_cache.hpp b/rmw_zenoh_cpp/src/detail/graph_cache.hpp index ce23e3cc..8ac2172d 100644 --- a/rmw_zenoh_cpp/src/detail/graph_cache.hpp +++ b/rmw_zenoh_cpp/src/detail/graph_cache.hpp @@ -23,15 +23,17 @@ #include #include #include +#include #include "event.hpp" #include "liveliness_utils.hpp" #include "ordered_map.hpp" #include "rcutils/allocator.h" -#include "rcutils/types/string_array.h" +#include "rcutils/types.h" -#include "rmw/topic_endpoint_info_array.h" +#include "rmw/rmw.h" +#include "rmw/get_topic_endpoint_info.h" #include "rmw/names_and_types.h" diff --git a/rmw_zenoh_cpp/src/detail/liveliness_utils.cpp b/rmw_zenoh_cpp/src/detail/liveliness_utils.cpp index 45918d92..52c8ec7f 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 @@ -23,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -31,6 +30,8 @@ #include "qos.hpp" #include "simplified_xxhash3.hpp" +#include "rcpputils/scope_exit.hpp" + #include "rmw/error_handling.h" namespace rmw_zenoh_cpp diff --git a/rmw_zenoh_cpp/src/detail/liveliness_utils.hpp b/rmw_zenoh_cpp/src/detail/liveliness_utils.hpp index e0c7cf9c..895ae604 100644 --- a/rmw_zenoh_cpp/src/detail/liveliness_utils.hpp +++ b/rmw_zenoh_cpp/src/detail/liveliness_utils.hpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "rmw/types.h" diff --git a/rmw_zenoh_cpp/src/detail/rmw_client_data.cpp b/rmw_zenoh_cpp/src/detail/rmw_client_data.cpp index d4b70440..ba73bdf3 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_client_data.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_client_data.cpp @@ -15,23 +15,30 @@ #include "rmw_client_data.hpp" #include -#include #include +#include #include #include #include #include +#include +#include #include +#include "attachment_helpers.hpp" #include "cdr.hpp" #include "liveliness_utils.hpp" #include "logging_macros.hpp" +#include "message_type_support.hpp" #include "qos.hpp" #include "rmw_context_impl_s.hpp" #include "rcpputils/scope_exit.hpp" + #include "rmw/error_handling.h" +#include "rmw/get_topic_endpoint_info.h" +#include "rmw/impl/cpp/macros.hpp" namespace { diff --git a/rmw_zenoh_cpp/src/detail/rmw_client_data.hpp b/rmw_zenoh_cpp/src/detail/rmw_client_data.hpp index d6650677..b78c1744 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_client_data.hpp +++ b/rmw_zenoh_cpp/src/detail/rmw_client_data.hpp @@ -22,13 +22,20 @@ #include #include #include +#include #include +#include #include "event.hpp" #include "liveliness_utils.hpp" +#include "message_type_support.hpp" #include "service_type_support.hpp" +#include "type_support_common.hpp" #include "zenoh_utils.hpp" +#include "rcutils/allocator.h" + +#include "rmw/rmw.h" #include "rmw/ret_types.h" namespace rmw_zenoh_cpp diff --git a/rmw_zenoh_cpp/src/detail/rmw_node_data.hpp b/rmw_zenoh_cpp/src/detail/rmw_node_data.hpp index 917f45e2..e26dd166 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_node_data.hpp +++ b/rmw_zenoh_cpp/src/detail/rmw_node_data.hpp @@ -30,6 +30,8 @@ #include "rmw_subscription_data.hpp" #include "rmw_service_data.hpp" +#include "rmw/rmw.h" + namespace rmw_zenoh_cpp { ///============================================================================= diff --git a/rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp b/rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp index 6f2a9284..db096144 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp @@ -16,12 +16,14 @@ #include +#include #include #include #include #include #include "cdr.hpp" +#include "rmw_context_impl_s.hpp" #include "message_type_support.hpp" #include "logging_macros.hpp" #include "qos.hpp" @@ -31,6 +33,7 @@ #include "rmw/error_handling.h" #include "rmw/get_topic_endpoint_info.h" +#include "rmw/impl/cpp/macros.hpp" namespace rmw_zenoh_cpp { diff --git a/rmw_zenoh_cpp/src/detail/rmw_publisher_data.hpp b/rmw_zenoh_cpp/src/detail/rmw_publisher_data.hpp index 22489298..4186f434 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_publisher_data.hpp +++ b/rmw_zenoh_cpp/src/detail/rmw_publisher_data.hpp @@ -27,7 +27,11 @@ #include "event.hpp" #include "liveliness_utils.hpp" #include "message_type_support.hpp" +#include "type_support_common.hpp" +#include "rcutils/allocator.h" + +#include "rmw/rmw.h" #include "rmw/ret_types.h" namespace rmw_zenoh_cpp diff --git a/rmw_zenoh_cpp/src/detail/rmw_service_data.cpp b/rmw_zenoh_cpp/src/detail/rmw_service_data.cpp index 7eab62d9..012ffe4a 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_service_data.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_service_data.cpp @@ -15,8 +15,8 @@ #include "rmw_service_data.hpp" #include -#include +#include #include #include #include @@ -25,12 +25,16 @@ #include "attachment_helpers.hpp" #include "cdr.hpp" +#include "rmw_context_impl_s.hpp" +#include "message_type_support.hpp" #include "logging_macros.hpp" #include "qos.hpp" #include "rcpputils/scope_exit.hpp" #include "rmw/error_handling.h" +#include "rmw/get_topic_endpoint_info.h" +#include "rmw/impl/cpp/macros.hpp" namespace rmw_zenoh_cpp { diff --git a/rmw_zenoh_cpp/src/detail/rmw_service_data.hpp b/rmw_zenoh_cpp/src/detail/rmw_service_data.hpp index a8f9d925..f0676635 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_service_data.hpp +++ b/rmw_zenoh_cpp/src/detail/rmw_service_data.hpp @@ -22,14 +22,20 @@ #include #include #include +#include #include #include #include "event.hpp" #include "liveliness_utils.hpp" +#include "message_type_support.hpp" #include "service_type_support.hpp" +#include "type_support_common.hpp" #include "zenoh_utils.hpp" +#include "rcutils/allocator.h" + +#include "rmw/rmw.h" #include "rmw/ret_types.h" namespace rmw_zenoh_cpp diff --git a/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp b/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp index 68c86c60..b50debb7 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp @@ -16,6 +16,7 @@ #include +#include #include #include #include @@ -26,16 +27,16 @@ #include "attachment_helpers.hpp" #include "cdr.hpp" #include "identifier.hpp" +#include "rmw_context_impl_s.hpp" #include "message_type_support.hpp" #include "logging_macros.hpp" #include "qos.hpp" -// Use the implemented rmw_context_impl_t -#include "rmw_context_impl_s.hpp" #include "rcpputils/scope_exit.hpp" #include "rmw/error_handling.h" #include "rmw/get_topic_endpoint_info.h" +#include "rmw/impl/cpp/macros.hpp" namespace rmw_zenoh_cpp { diff --git a/rmw_zenoh_cpp/src/detail/type_support.cpp b/rmw_zenoh_cpp/src/detail/type_support.cpp index b2cc2848..fff22474 100644 --- a/rmw_zenoh_cpp/src/detail/type_support.cpp +++ b/rmw_zenoh_cpp/src/detail/type_support.cpp @@ -17,6 +17,8 @@ // https://github.com/ros2/rmw_fastrtps/blob/469624e3d483290d6f88fe4b89ee5feaa7694e61/rmw_fastrtps_cpp/src/type_support_common.hpp #include +#include +#include #include "rmw/error_handling.h" diff --git a/rmw_zenoh_cpp/src/detail/zenoh_config.cpp b/rmw_zenoh_cpp/src/detail/zenoh_config.cpp index 71e7bc43..2537466b 100644 --- a/rmw_zenoh_cpp/src/detail/zenoh_config.cpp +++ b/rmw_zenoh_cpp/src/detail/zenoh_config.cpp @@ -18,8 +18,6 @@ #include #include -#include -#include #include "logging_macros.hpp" diff --git a/rmw_zenoh_cpp/src/detail/zenoh_config.hpp b/rmw_zenoh_cpp/src/detail/zenoh_config.hpp index e07ca233..dceafe5d 100644 --- a/rmw_zenoh_cpp/src/detail/zenoh_config.hpp +++ b/rmw_zenoh_cpp/src/detail/zenoh_config.hpp @@ -18,6 +18,8 @@ #include #include +#include +#include #include "rmw/ret_types.h" diff --git a/rmw_zenoh_cpp/src/detail/zenoh_router_check.cpp b/rmw_zenoh_cpp/src/detail/zenoh_router_check.cpp index 81aed621..b6c5d21e 100644 --- a/rmw_zenoh_cpp/src/detail/zenoh_router_check.cpp +++ b/rmw_zenoh_cpp/src/detail/zenoh_router_check.cpp @@ -16,6 +16,8 @@ #include +#include +#include #include #include "logging_macros.hpp" diff --git a/rmw_zenoh_cpp/src/detail/zenoh_utils.cpp b/rmw_zenoh_cpp/src/detail/zenoh_utils.cpp index d6f7770c..d1ab4651 100644 --- a/rmw_zenoh_cpp/src/detail/zenoh_utils.cpp +++ b/rmw_zenoh_cpp/src/detail/zenoh_utils.cpp @@ -15,9 +15,12 @@ #include "zenoh_utils.hpp" #include +#include #include "attachment_helpers.hpp" -#include "rmw/types.h" +#include "rcpputils/scope_exit.hpp" + +#include "rmw/error_handling.h" namespace rmw_zenoh_cpp { diff --git a/rmw_zenoh_cpp/src/detail/zenoh_utils.hpp b/rmw_zenoh_cpp/src/detail/zenoh_utils.hpp index 569d1ab1..5f569082 100644 --- a/rmw_zenoh_cpp/src/detail/zenoh_utils.hpp +++ b/rmw_zenoh_cpp/src/detail/zenoh_utils.hpp @@ -18,6 +18,7 @@ #include #include +#include #include #include "rmw/types.h" diff --git a/rmw_zenoh_cpp/src/rmw_event.cpp b/rmw_zenoh_cpp/src/rmw_event.cpp index ac0a34ca..63de9bcb 100644 --- a/rmw_zenoh_cpp/src/rmw_event.cpp +++ b/rmw_zenoh_cpp/src/rmw_event.cpp @@ -14,6 +14,7 @@ #include "rmw/error_handling.h" #include "rmw/event.h" +#include "rmw/events_statuses/events_statuses.h" #include "rmw/types.h" #include "detail/event.hpp" diff --git a/rmw_zenoh_cpp/src/rmw_init.cpp b/rmw_zenoh_cpp/src/rmw_init.cpp index e57720fa..e76d6062 100644 --- a/rmw_zenoh_cpp/src/rmw_init.cpp +++ b/rmw_zenoh_cpp/src/rmw_init.cpp @@ -14,12 +14,20 @@ #include +#include #include +#include +#include "detail/guard_condition.hpp" #include "detail/identifier.hpp" +#include "detail/liveliness_utils.hpp" #include "detail/rmw_context_impl_s.hpp" #include "detail/zenoh_config.hpp" +#include "rcutils/env.h" +#include "detail/logging_macros.hpp" +#include "rcutils/strdup.h" +#include "rcutils/types.h" #include "rmw/init.h" #include "rmw/impl/cpp/macros.hpp" diff --git a/rmw_zenoh_cpp/src/rmw_init_options.cpp b/rmw_zenoh_cpp/src/rmw_init_options.cpp index b5242035..783c5a6a 100644 --- a/rmw_zenoh_cpp/src/rmw_init_options.cpp +++ b/rmw_zenoh_cpp/src/rmw_init_options.cpp @@ -16,11 +16,13 @@ #include #include "detail/identifier.hpp" +#include "detail/rmw_init_options_impl.hpp" #include "rcpputils/scope_exit.hpp" #include "rcutils/allocator.h" #include "rcutils/strdup.h" +#include "rcutils/types.h" #include "rmw/impl/cpp/macros.hpp" #include "rmw/init_options.h" diff --git a/rmw_zenoh_cpp/src/rmw_zenoh.cpp b/rmw_zenoh_cpp/src/rmw_zenoh.cpp index fbe747a8..885baaf6 100644 --- a/rmw_zenoh_cpp/src/rmw_zenoh.cpp +++ b/rmw_zenoh_cpp/src/rmw_zenoh.cpp @@ -13,35 +13,45 @@ // limitations under the License. #include -#include #include #include #include #include +#include #include +#include +#include #include #include +#include "detail/attachment_helpers.hpp" #include "detail/cdr.hpp" #include "detail/guard_condition.hpp" +#include "detail/graph_cache.hpp" #include "detail/identifier.hpp" -#include "detail/logging.hpp" #include "detail/liveliness_utils.hpp" +#include "detail/logging_macros.hpp" #include "detail/message_type_support.hpp" +#include "detail/qos.hpp" #include "detail/rmw_context_impl_s.hpp" #include "detail/serialization_format.hpp" #include "detail/type_support_common.hpp" +#include "detail/zenoh_utils.hpp" #include "rcpputils/scope_exit.hpp" + +#include "rcutils/env.h" #include "rcutils/strdup.h" +#include "rcutils/types.h" + +#include "rmw/allocators.h" #include "rmw/dynamic_message_type_support.h" #include "rmw/error_handling.h" #include "rmw/features.h" #include "rmw/impl/cpp/macros.hpp" #include "rmw/ret_types.h" #include "rmw/rmw.h" -#include "rmw/types.h" #include "rmw/validate_namespace.h" #include "rmw/validate_node_name.h"