| 318 | } |
| 319 | |
| 320 | bool findTopicInMap(map<string, map<string, string>>& topic2info, // NOLINT |
| 321 | string topic_name, |
| 322 | map<string, map<string, string>>::iterator& element) { // NOLINT |
| 323 | element = topic2info.end(); |
| 324 | |
| 325 | bool res = false; |
| 326 | if (topic2info.find(topic_name) != topic2info.end()) { |
| 327 | element = topic2info.find(topic_name); |
| 328 | res = true; |
| 329 | } else { |
| 330 | size_t first_slash = topic_name.find_first_of("/"); |
| 331 | if (first_slash == 0) { |
| 332 | if (topic2info.find(topic_name.substr(1)) != topic2info.end()) { |
| 333 | element = topic2info.find(topic_name.substr(1)); |
| 334 | res = true; |
| 335 | } |
| 336 | } else { |
| 337 | if (topic2info.find("/" + topic_name) != topic2info.end()) { |
| 338 | element = topic2info.find("/" + topic_name); |
| 339 | res = true; |
| 340 | } |
| 341 | } |
| 342 | } |
| 343 | return res; |
| 344 | } |
| 345 | |
| 346 | int main(int argc, char** argv) { |
| 347 | cout << colouredString("Initializing ROS node:", RED, BOLD) << endl; |