From 15bd88de92d3a65d1d31fcd2486031c9830a58a2 Mon Sep 17 00:00:00 2001 From: ChenYing Kuo Date: Mon, 2 Dec 2024 14:11:10 +0800 Subject: [PATCH] Rename the API to match the latest zenoh-c Signed-off-by: ChenYing Kuo --- rmw_zenoh_cpp/src/detail/rmw_client_data.cpp | 4 ++-- rmw_zenoh_cpp/src/detail/rmw_client_data.hpp | 2 +- rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp | 10 +++++----- rmw_zenoh_cpp/src/detail/rmw_node_data.cpp | 8 ++++---- rmw_zenoh_cpp/src/detail/rmw_node_data.hpp | 4 ++-- rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp | 8 ++++---- rmw_zenoh_cpp/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 | 2 +- rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp | 4 ++-- rmw_zenoh_cpp/src/detail/rmw_subscription_data.hpp | 2 +- zenoh_c_vendor/CMakeLists.txt | 2 +- 12 files changed, 27 insertions(+), 27 deletions(-) diff --git a/rmw_zenoh_cpp/src/detail/rmw_client_data.cpp b/rmw_zenoh_cpp/src/detail/rmw_client_data.cpp index ba73bdf3..d70ce9d5 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_client_data.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_client_data.cpp @@ -252,7 +252,7 @@ bool ClientData::init(const z_loaned_session_t * session) [this]() { z_drop(z_move(this->token_)); }); - if (zc_liveliness_declare_token( + if (z_liveliness_declare_token( session, &this->token_, z_loan(liveliness_ke), @@ -518,7 +518,7 @@ void ClientData::_shutdown() } // Unregister this node from the ROS graph. - zc_liveliness_undeclare_token(z_move(token_)); + z_liveliness_undeclare_token(z_move(token_)); z_drop(z_move(keyexpr_)); diff --git a/rmw_zenoh_cpp/src/detail/rmw_client_data.hpp b/rmw_zenoh_cpp/src/detail/rmw_client_data.hpp index b78c1744..b2cbbbdf 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_client_data.hpp +++ b/rmw_zenoh_cpp/src/detail/rmw_client_data.hpp @@ -131,7 +131,7 @@ class ClientData final : public std::enable_shared_from_this // An owned keyexpression. z_owned_keyexpr_t keyexpr_; // Liveliness token for the service. - zc_owned_liveliness_token_t token_; + z_owned_liveliness_token_t token_; // Type support fields. const void * request_type_support_impl_; const void * response_type_support_impl_; 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 7915cd9e..aa6fb1ed 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_context_impl_s.cpp @@ -124,7 +124,7 @@ class rmw_context_impl_s::Data final // Query router/liveliness participants to get graph information before the session was started. // We create a blocking channel that is unbounded, ie. `bound` = 0, to receive - // replies for the zc_liveliness_get() call. This is necessary as if the `bound` + // replies for the z_liveliness_get() call. This is necessary as if the `bound` // is too low, the channel may starve the zenoh executor of its threads which // would lead to deadlocks when trying to receive replies and block the // execution here. @@ -143,7 +143,7 @@ class rmw_context_impl_s::Data final z_view_keyexpr_t keyexpr; z_view_keyexpr_from_str(&keyexpr, liveliness_str.c_str()); - zc_liveliness_get( + z_liveliness_get( z_loan(session_), z_loan(keyexpr), z_move(closure), NULL); z_owned_reply_t reply; @@ -196,8 +196,8 @@ class rmw_context_impl_s::Data final // Setup the liveliness subscriber to receives updates from the ROS graph // and update the graph cache. - zc_liveliness_subscriber_options_t sub_options; - zc_liveliness_subscriber_options_default(&sub_options); + z_liveliness_subscriber_options_t sub_options; + z_liveliness_subscriber_options_default(&sub_options); z_owned_closure_sample_t callback; z_closure(&callback, graph_sub_data_handler, nullptr, this); z_view_keyexpr_t liveliness_ke; @@ -206,7 +206,7 @@ class rmw_context_impl_s::Data final [this]() { z_undeclare_subscriber(z_move(this->graph_subscriber_)); }); - if (zc_liveliness_declare_subscriber( + if (z_liveliness_declare_subscriber( z_loan(session_), &graph_subscriber_, z_loan(liveliness_ke), z_move(callback), &sub_options) != Z_OK) diff --git a/rmw_zenoh_cpp/src/detail/rmw_node_data.cpp b/rmw_zenoh_cpp/src/detail/rmw_node_data.cpp index 96d95191..dda0717e 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_node_data.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_node_data.cpp @@ -60,12 +60,12 @@ std::shared_ptr NodeData::make( std::string liveliness_keyexpr = entity->liveliness_keyexpr(); z_view_keyexpr_t liveliness_ke; z_view_keyexpr_from_str(&liveliness_ke, liveliness_keyexpr.c_str()); - zc_owned_liveliness_token_t token; + z_owned_liveliness_token_t token; auto free_token = rcpputils::make_scope_exit( [&token]() { z_drop(z_move(token)); }); - if (zc_liveliness_declare_token(session, &token, z_loan(liveliness_ke), NULL) != Z_OK) { + if (z_liveliness_declare_token(session, &token, z_loan(liveliness_ke), NULL) != Z_OK) { RMW_ZENOH_LOG_ERROR_NAMED( "rmw_zenoh_cpp", "Unable to create liveliness token for the node."); @@ -87,7 +87,7 @@ NodeData::NodeData( const rmw_node_t * const node, std::size_t id, std::shared_ptr entity, - zc_owned_liveliness_token_t token) + z_owned_liveliness_token_t token) : node_(node), id_(std::move(id)), entity_(std::move(entity)), @@ -402,7 +402,7 @@ rmw_ret_t NodeData::shutdown() } // Unregister this node from the ROS graph. - zc_liveliness_undeclare_token(z_move(token_)); + z_liveliness_undeclare_token(z_move(token_)); is_shutdown_ = true; return ret; diff --git a/rmw_zenoh_cpp/src/detail/rmw_node_data.hpp b/rmw_zenoh_cpp/src/detail/rmw_node_data.hpp index e26dd166..ab17e096 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_node_data.hpp +++ b/rmw_zenoh_cpp/src/detail/rmw_node_data.hpp @@ -128,7 +128,7 @@ class NodeData final const rmw_node_t * const node, std::size_t id, std::shared_ptr entity, - zc_owned_liveliness_token_t token); + z_owned_liveliness_token_t token); // Internal mutex. mutable std::recursive_mutex mutex_; // The rmw_node_t associated with this NodeData. @@ -139,7 +139,7 @@ class NodeData final // The Entity generated for the node. std::shared_ptr entity_; // Liveliness token for the node. - zc_owned_liveliness_token_t token_; + z_owned_liveliness_token_t token_; // Shutdown flag. bool is_shutdown_; // Map of publishers. diff --git a/rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp b/rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp index db096144..ba261841 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_publisher_data.cpp @@ -171,12 +171,12 @@ std::shared_ptr PublisherData::make( std::string liveliness_keyexpr = entity->liveliness_keyexpr(); z_view_keyexpr_t liveliness_ke; z_view_keyexpr_from_str(&liveliness_ke, liveliness_keyexpr.c_str()); - zc_owned_liveliness_token_t token; + z_owned_liveliness_token_t token; auto free_token = rcpputils::make_scope_exit( [&token]() { z_drop(z_move(token)); }); - if (zc_liveliness_declare_token( + if (z_liveliness_declare_token( session, &token, z_loan(liveliness_ke), NULL) != Z_OK) { @@ -208,7 +208,7 @@ PublisherData::PublisherData( std::shared_ptr entity, z_owned_publisher_t pub, std::optional pub_cache, - zc_owned_liveliness_token_t token, + z_owned_liveliness_token_t token, const void * type_support_impl, std::unique_ptr type_support) : rmw_node_(rmw_node), @@ -431,7 +431,7 @@ rmw_ret_t PublisherData::shutdown() } // Unregister this publisher from the ROS graph. - zc_liveliness_undeclare_token(z_move(token_)); + z_liveliness_undeclare_token(z_move(token_)); if (pub_cache_.has_value()) { z_drop(z_move(pub_cache_.value())); } diff --git a/rmw_zenoh_cpp/src/detail/rmw_publisher_data.hpp b/rmw_zenoh_cpp/src/detail/rmw_publisher_data.hpp index 4186f434..21bbe620 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_publisher_data.hpp +++ b/rmw_zenoh_cpp/src/detail/rmw_publisher_data.hpp @@ -89,7 +89,7 @@ class PublisherData final std::shared_ptr entity, z_owned_publisher_t pub, std::optional pub_cache, - zc_owned_liveliness_token_t token, + z_owned_liveliness_token_t token, const void * type_support_impl, std::unique_ptr type_support); @@ -104,7 +104,7 @@ class PublisherData final // Optional publication cache when durability is transient_local. std::optional pub_cache_; // Liveliness token for the publisher. - zc_owned_liveliness_token_t token_; + z_owned_liveliness_token_t token_; // Type support fields const void * type_support_impl_; std::unique_ptr type_support_; diff --git a/rmw_zenoh_cpp/src/detail/rmw_service_data.cpp b/rmw_zenoh_cpp/src/detail/rmw_service_data.cpp index 012ffe4a..f4c92d0a 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_service_data.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_service_data.cpp @@ -195,7 +195,7 @@ std::shared_ptr ServiceData::make( z_drop(z_move(service_data->token_)); } }); - if (zc_liveliness_declare_token( + if (z_liveliness_declare_token( session, &service_data->token_, z_loan(liveliness_ke), NULL) != Z_OK) { @@ -495,7 +495,7 @@ rmw_ret_t ServiceData::shutdown() } // Unregister this node from the ROS graph. - zc_liveliness_undeclare_token(z_move(token_)); + z_liveliness_undeclare_token(z_move(token_)); z_undeclare_queryable(z_move(qable_)); is_shutdown_ = true; diff --git a/rmw_zenoh_cpp/src/detail/rmw_service_data.hpp b/rmw_zenoh_cpp/src/detail/rmw_service_data.hpp index f0676635..ba36e6e5 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_service_data.hpp +++ b/rmw_zenoh_cpp/src/detail/rmw_service_data.hpp @@ -112,7 +112,7 @@ class ServiceData final // An owned queryable. z_owned_queryable_t qable_; // Liveliness token for the service. - zc_owned_liveliness_token_t token_; + z_owned_liveliness_token_t token_; // Type support fields. const void * request_type_support_impl_; const void * response_type_support_impl_; diff --git a/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp b/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp index b50debb7..1b485a64 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp +++ b/rmw_zenoh_cpp/src/detail/rmw_subscription_data.cpp @@ -324,7 +324,7 @@ bool SubscriptionData::init() [this]() { z_drop(z_move(token_)); }); - if (zc_liveliness_declare_token( + if (z_liveliness_declare_token( context_impl->session(), &token_, z_loan(liveliness_ke), NULL) != Z_OK) { RMW_ZENOH_LOG_ERROR_NAMED( @@ -393,7 +393,7 @@ rmw_ret_t SubscriptionData::shutdown() graph_cache_->remove_qos_event_callbacks(entity_->keyexpr_hash()); // Unregister this subscription from the ROS graph. - zc_liveliness_undeclare_token(z_move(token_)); + z_liveliness_undeclare_token(z_move(token_)); z_owned_subscriber_t * sub = std::get_if(&sub_); if (sub != nullptr) { diff --git a/rmw_zenoh_cpp/src/detail/rmw_subscription_data.hpp b/rmw_zenoh_cpp/src/detail/rmw_subscription_data.hpp index 6d17fbf4..3d1ccede 100644 --- a/rmw_zenoh_cpp/src/detail/rmw_subscription_data.hpp +++ b/rmw_zenoh_cpp/src/detail/rmw_subscription_data.hpp @@ -139,7 +139,7 @@ class SubscriptionData final : public std::enable_shared_from_this sub_; // Liveliness token for the subscription. - zc_owned_liveliness_token_t token_; + z_owned_liveliness_token_t token_; // Type support fields const void * type_support_impl_; std::unique_ptr type_support_; diff --git a/zenoh_c_vendor/CMakeLists.txt b/zenoh_c_vendor/CMakeLists.txt index 086ea5db..aada8537 100644 --- a/zenoh_c_vendor/CMakeLists.txt +++ b/zenoh_c_vendor/CMakeLists.txt @@ -26,7 +26,7 @@ set(ZENOHC_CARGO_FLAGS "--no-default-features$--features=shared-memor # - https://github.com/eclipse-zenoh/zenoh-c/pull/620 (fix ze_querying_subscriber_get API to query newly discovered publishers) ament_vendor(zenoh_c_vendor VCS_URL https://github.com/eclipse-zenoh/zenoh-c.git - VCS_VERSION 4b759d4e4d35a97d7b20b5c4003b8b764a10f679 + VCS_VERSION bd7c7172ff5a38d43dedf72dc2cf03607743e826 CMAKE_ARGS "-DZENOHC_CARGO_FLAGS=${ZENOHC_CARGO_FLAGS}" "-DZENOHC_BUILD_WITH_UNSTABLE_API=TRUE"