Skip to content

Commit

Permalink
Instantiate new topic data for cache
Browse files Browse the repository at this point in the history
Signed-off-by: Yadunund <[email protected]>
  • Loading branch information
Yadunund committed Dec 2, 2023
1 parent 1bfc2c1 commit 4f8c7ce
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion rmw_zenoh_cpp/src/detail/graph_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,13 @@ void GraphCache::parse_put(const std::string & keyexpr)
GraphNode::TopicMap::iterator cache_topic_it = graph_topics_.find(topic_info.name_);
if (cache_topic_it == graph_topics_.end()) {
// First time this topic name is added to the graph.
graph_topics_[topic_info.name_] = std::move(topic_data_map);
std::shared_ptr<TopicData> topic_data_ptr = std::make_shared<TopicData>(
topic_info,
TopicStats{pub_count, sub_count}
);
graph_topics_[topic_info.name_] = GraphNode::TopicDataMap{
{topic_info.type_, topic_data_ptr}
};
} else {
// If a TopicData entry for the same type exists in the topic map, update pub/sub counts
// or else create an new TopicData.
Expand Down

0 comments on commit 4f8c7ce

Please sign in to comment.