Skip to content

Commit

Permalink
Const qualify function to check if service is avaialble (#260)
Browse files Browse the repository at this point in the history
Signed-off-by: Yadunund <[email protected]>
  • Loading branch information
Yadunund authored Aug 7, 2024
1 parent a701097 commit b78d6a1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions rmw_zenoh_cpp/src/detail/graph_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::mutex> 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) {
Expand Down
2 changes: 1 addition & 1 deletion rmw_zenoh_cpp/src/detail/graph_cache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit b78d6a1

Please sign in to comment.