From b78d6a15ca47681ddd11613c085fe41420fa9168 Mon Sep 17 00:00:00 2001 From: Yadu Date: Wed, 7 Aug 2024 13:51:57 +0200 Subject: [PATCH] Const qualify function to check if service is avaialble (#260) Signed-off-by: Yadunund --- rmw_zenoh_cpp/src/detail/graph_cache.cpp | 6 +++--- rmw_zenoh_cpp/src/detail/graph_cache.hpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rmw_zenoh_cpp/src/detail/graph_cache.cpp b/rmw_zenoh_cpp/src/detail/graph_cache.cpp index 79bff430..00e78be6 100644 --- a/rmw_zenoh_cpp/src/detail/graph_cache.cpp +++ b/rmw_zenoh_cpp/src/detail/graph_cache.cpp @@ -1202,13 +1202,13 @@ rmw_ret_t GraphCache::get_entities_info_by_topic( rmw_ret_t GraphCache::service_server_is_available( const char * service_name, const char * service_type, - bool * is_available) + bool * is_available) const { *is_available = false; std::lock_guard lock(graph_mutex_); - GraphNode::TopicMap::iterator service_it = graph_services_.find(service_name); + GraphNode::TopicMap::const_iterator service_it = graph_services_.find(service_name); if (service_it != graph_services_.end()) { - GraphNode::TopicTypeMap::iterator type_it = service_it.value().find(service_type); + GraphNode::TopicTypeMap::const_iterator type_it = service_it->second.find(service_type); if (type_it != service_it->second.end()) { for (const auto & [_, topic_data] : type_it->second) { if (topic_data->subs_.size() > 0) { diff --git a/rmw_zenoh_cpp/src/detail/graph_cache.hpp b/rmw_zenoh_cpp/src/detail/graph_cache.hpp index 47d33765..8d2b6802 100644 --- a/rmw_zenoh_cpp/src/detail/graph_cache.hpp +++ b/rmw_zenoh_cpp/src/detail/graph_cache.hpp @@ -167,7 +167,7 @@ class GraphCache final rmw_ret_t service_server_is_available( const char * service_name, const char * service_type, - bool * is_available); + bool * is_available) const; /// @brief Signature for a function that will be invoked by the GraphCache when a QoS /// event is detected.