{"action":"created","comment":{"url":"https://api.github.com/repos/ros2/rmw_connext/pulls/comments/36121056","id":36121056,"diff_hunk":"@@ -1630,4 +1846,246 @@ rmw_send_response(\n   return RMW_RET_OK;\n }\n \n+void\n+destroy_topic_names_and_types(\n+  rmw_topic_names_and_types_t * topic_names_and_types)\n+{\n+  if (topic_names_and_types->topic_count) {\n+    for (size_t i = 0; i < topic_names_and_types->topic_count; ++i) {\n+      delete topic_names_and_types->topic_names[i];\n+      delete topic_names_and_types->type_names[i];\n+      topic_names_and_types->topic_names[i] = nullptr;\n+      topic_names_and_types->type_names[i] = nullptr;\n+    }\n+    if (topic_names_and_types->topic_names) {\n+      rmw_free(topic_names_and_types->topic_names);\n+      topic_names_and_types->topic_names = nullptr;\n+    }\n+    if (topic_names_and_types->type_names) {\n+      rmw_free(topic_names_and_types->type_names);\n+      topic_names_and_types->type_names = nullptr;\n+    }\n+    topic_names_and_types->topic_count = 0;\n+  }\n+}\n+\n+rmw_ret_t\n+rmw_get_topic_names_and_types(\n+  const rmw_node_t * node,\n+  rmw_topic_names_and_types_t * topic_names_and_types)\n+{\n+  if (!node) {\n+    RMW_SET_ERROR_MSG(\"node handle is null\");\n+    return RMW_RET_ERROR;\n+  }\n+  if (node->implementation_identifier != rti_connext_identifier) {\n+    RMW_SET_ERROR_MSG(\"node handle is not from this rmw implementation\");\n+    return RMW_RET_ERROR;\n+  }\n+  if (!topic_names_and_types) {\n+    RMW_SET_ERROR_MSG(\"topics handle is null\");\n+    return RMW_RET_ERROR;\n+  }\n+  if (topic_names_and_types->topic_count) {\n+    RMW_SET_ERROR_MSG(\"topic count is not zero\");\n+    return RMW_RET_ERROR;\n+  }\n+  if (topic_names_and_types->topic_names) {\n+    RMW_SET_ERROR_MSG(\"topic names is not null\");\n+    return RMW_RET_ERROR;\n+  }\n+  if (topic_names_and_types->type_names) {\n+    RMW_SET_ERROR_MSG(\"type names is not null\");\n+    return RMW_RET_ERROR;\n+  }\n+\n+  auto node_info = static_cast<ConnextStaticNodeInfo *>(node->data);\n+  if (!node_info) {\n+    RMW_SET_ERROR_MSG(\"node info handle is null\");\n+    return RMW_RET_ERROR;\n+  }\n+  if (!node_info->publisher_listener) {\n+    RMW_SET_ERROR_MSG(\"publisher listener handle is null\");\n+    return RMW_RET_ERROR;\n+  }\n+  if (!node_info->subscriber_listener) {\n+    RMW_SET_ERROR_MSG(\"subscriber listener handle is null\");\n+    return RMW_RET_ERROR;\n+  }\n+\n+  // combine publisher and subscriber information\n+  std::map<std::string, std::set<std::string>> topics_with_multiple_types;\n+  for (auto it : node_info->publisher_listener->topic_names_and_types) {\n+    for (auto jt : it.second) {\n+      topics_with_multiple_types[it.first].insert(jt);\n+    }\n+  }\n+  for (auto it : node_info->subscriber_listener->topic_names_and_types) {\n+    for (auto jt : it.second) {\n+      topics_with_multiple_types[it.first].insert(jt);\n+    }\n+  }\n+\n+  // ignore inconsistent types\n+  std::map<std::string, std::string> topics;\n+  for (auto it : topics_with_multiple_types) {\n+    if (it.second.size() != 1) {\n+      fprintf(stderr, \"topic type mismatch - ignoring topic '%s'\\n\", it.first.c_str());\n+      continue;\n+    }\n+    topics[it.first] = *it.second.begin();\n+  }\n+\n+  // reformat type name\n+  std::string substr = \"::msg::dds_::\";\n+  for (auto it : topics) {\n+    size_t substr_pos = it.second.find(substr);\n+    if (it.second[it.second.size() - 1] == '_' && substr_pos != std::string::npos)\n+    {\n+      it.second = it.second.substr(0, substr_pos) + \"/\" +\n+        it.second.substr(substr_pos + substr.size(), it.second.size() - substr_pos - substr.size() - 1);\n+      topics[it.first] = it.second;","path":"rmw_connext_cpp/src/functions.cpp","position":435,"original_position":435,"commit_id":"7a8256853d10af6c93684b905f68b0a64385245c","original_commit_id":"7a8256853d10af6c93684b905f68b0a64385245c","user":{"login":"wjwwood","id":100427,"avatar_url":"https://avatars.githubusercontent.com/u/100427?v=3","gravatar_id":"","url":"https://api.github.com/users/wjwwood","html_url":"https://github.com/wjwwood","followers_url":"https://api.github.com/users/wjwwood/followers","following_url":"https://api.github.com/users/wjwwood/following{/other_user}","gists_url":"https://api.github.com/users/wjwwood/gists{/gist_id}","starred_url":"https://api.github.com/users/wjwwood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wjwwood/subscriptions","organizations_url":"https://api.github.com/users/wjwwood/orgs","repos_url":"https://api.github.com/users/wjwwood/repos","events_url":"https://api.github.com/users/wjwwood/events{/privacy}","received_events_url":"https://api.github.com/users/wjwwood/received_events","type":"User","site_admin":false},"body":"I don't think this should be necessary if you get a reference to the pair from the `topics` map.","created_at":"2015-08-03T19:25:22Z","updated_at":"2015-08-03T19:25:22Z","html_url":"https://github.com/ros2/rmw_connext/pull/65#discussion_r36121056","pull_request_url":"https://api.github.com/repos/ros2/rmw_connext/pulls/65","_links":{"self":{"href":"https://api.github.com/repos/ros2/rmw_connext/pulls/comments/36121056"},"html":{"href":"https://github.com/ros2/rmw_connext/pull/65#discussion_r36121056"},"pull_request":{"href":"https://api.github.com/repos/ros2/rmw_connext/pulls/65"}}},"pull_request":{"url":"https://api.github.com/repos/ros2/rmw_connext/pulls/65","id":41498422,"html_url":"https://github.com/ros2/rmw_connext/pull/65","diff_url":"https://github.com/ros2/rmw_connext/pull/65.diff","patch_url":"https://github.com/ros2/rmw_connext/pull/65.patch","issue_url":"https://api.github.com/repos/ros2/rmw_connext/issues/65","number":65,"state":"open","locked":false,"title":"Topic information","user":{"login":"dirk-thomas","id":1335366,"avatar_url":"https://avatars.githubusercontent.com/u/1335366?v=3","gravatar_id":"","url":"https://api.github.com/users/dirk-thomas","html_url":"https://github.com/dirk-thomas","followers_url":"https://api.github.com/users/dirk-thomas/followers","following_url":"https://api.github.com/users/dirk-thomas/following{/other_user}","gists_url":"https://api.github.com/users/dirk-thomas/gists{/gist_id}","starred_url":"https://api.github.com/users/dirk-thomas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dirk-thomas/subscriptions","organizations_url":"https://api.github.com/users/dirk-thomas/orgs","repos_url":"https://api.github.com/users/dirk-thomas/repos","events_url":"https://api.github.com/users/dirk-thomas/events{/privacy}","received_events_url":"https://api.github.com/users/dirk-thomas/received_events","type":"User","site_admin":false},"body":"Connects to ros2/ros1_bridge#3\r\n\r\nThe `rmw_connext_cpp` implementation is ready for review.","created_at":"2015-08-03T19:01:59Z","updated_at":"2015-08-03T19:25:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5cf02c7b1fbb05e5ca9d3e320103b7bc1a50c072","assignee":{"login":"dirk-thomas","id":1335366,"avatar_url":"https://avatars.githubusercontent.com/u/1335366?v=3","gravatar_id":"","url":"https://api.github.com/users/dirk-thomas","html_url":"https://github.com/dirk-thomas","followers_url":"https://api.github.com/users/dirk-thomas/followers","following_url":"https://api.github.com/users/dirk-thomas/following{/other_user}","gists_url":"https://api.github.com/users/dirk-thomas/gists{/gist_id}","starred_url":"https://api.github.com/users/dirk-thomas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dirk-thomas/subscriptions","organizations_url":"https://api.github.com/users/dirk-thomas/orgs","repos_url":"https://api.github.com/users/dirk-thomas/repos","events_url":"https://api.github.com/users/dirk-thomas/events{/privacy}","received_events_url":"https://api.github.com/users/dirk-thomas/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/ros2/rmw_connext/pulls/65/commits","review_comments_url":"https://api.github.com/repos/ros2/rmw_connext/pulls/65/comments","review_comment_url":"https://api.github.com/repos/ros2/rmw_connext/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ros2/rmw_connext/issues/65/comments","statuses_url":"https://api.github.com/repos/ros2/rmw_connext/statuses/7a8256853d10af6c93684b905f68b0a64385245c","head":{"label":"ros2:topic_information","ref":"topic_information","sha":"7a8256853d10af6c93684b905f68b0a64385245c","user":{"login":"ros2","id":3979232,"avatar_url":"https://avatars.githubusercontent.com/u/3979232?v=3","gravatar_id":"","url":"https://api.github.com/users/ros2","html_url":"https://github.com/ros2","followers_url":"https://api.github.com/users/ros2/followers","following_url":"https://api.github.com/users/ros2/following{/other_user}","gists_url":"https://api.github.com/users/ros2/gists{/gist_id}","starred_url":"https://api.github.com/users/ros2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros2/subscriptions","organizations_url":"https://api.github.com/users/ros2/orgs","repos_url":"https://api.github.com/users/ros2/repos","events_url":"https://api.github.com/users/ros2/events{/privacy}","received_events_url":"https://api.github.com/users/ros2/received_events","type":"Organization","site_admin":false},"repo":{"id":22737329,"name":"rmw_connext","full_name":"ros2/rmw_connext","owner":{"login":"ros2","id":3979232,"avatar_url":"https://avatars.githubusercontent.com/u/3979232?v=3","gravatar_id":"","url":"https://api.github.com/users/ros2","html_url":"https://github.com/ros2","followers_url":"https://api.github.com/users/ros2/followers","following_url":"https://api.github.com/users/ros2/following{/other_user}","gists_url":"https://api.github.com/users/ros2/gists{/gist_id}","starred_url":"https://api.github.com/users/ros2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros2/subscriptions","organizations_url":"https://api.github.com/users/ros2/orgs","repos_url":"https://api.github.com/users/ros2/repos","events_url":"https://api.github.com/users/ros2/events{/privacy}","received_events_url":"https://api.github.com/users/ros2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ros2/rmw_connext","description":"Implementation of the ROS Middleware (rmw) Interface using RTI's Connext DDS.","fork":false,"url":"https://api.github.com/repos/ros2/rmw_connext","forks_url":"https://api.github.com/repos/ros2/rmw_connext/forks","keys_url":"https://api.github.com/repos/ros2/rmw_connext/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ros2/rmw_connext/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ros2/rmw_connext/teams","hooks_url":"https://api.github.com/repos/ros2/rmw_connext/hooks","issue_events_url":"https://api.github.com/repos/ros2/rmw_connext/issues/events{/number}","events_url":"https://api.github.com/repos/ros2/rmw_connext/events","assignees_url":"https://api.github.com/repos/ros2/rmw_connext/assignees{/user}","branches_url":"https://api.github.com/repos/ros2/rmw_connext/branches{/branch}","tags_url":"https://api.github.com/repos/ros2/rmw_connext/tags","blobs_url":"https://api.github.com/repos/ros2/rmw_connext/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ros2/rmw_connext/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ros2/rmw_connext/git/refs{/sha}","trees_url":"https://api.github.com/repos/ros2/rmw_connext/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ros2/rmw_connext/statuses/{sha}","languages_url":"https://api.github.com/repos/ros2/rmw_connext/languages","stargazers_url":"https://api.github.com/repos/ros2/rmw_connext/stargazers","contributors_url":"https://api.github.com/repos/ros2/rmw_connext/contributors","subscribers_url":"https://api.github.com/repos/ros2/rmw_connext/subscribers","subscription_url":"https://api.github.com/repos/ros2/rmw_connext/subscription","commits_url":"https://api.github.com/repos/ros2/rmw_connext/commits{/sha}","git_commits_url":"https://api.github.com/repos/ros2/rmw_connext/git/commits{/sha}","comments_url":"https://api.github.com/repos/ros2/rmw_connext/comments{/number}","issue_comment_url":"https://api.github.com/repos/ros2/rmw_connext/issues/comments{/number}","contents_url":"https://api.github.com/repos/ros2/rmw_connext/contents/{+path}","compare_url":"https://api.github.com/repos/ros2/rmw_connext/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ros2/rmw_connext/merges","archive_url":"https://api.github.com/repos/ros2/rmw_connext/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ros2/rmw_connext/downloads","issues_url":"https://api.github.com/repos/ros2/rmw_connext/issues{/number}","pulls_url":"https://api.github.com/repos/ros2/rmw_connext/pulls{/number}","milestones_url":"https://api.github.com/repos/ros2/rmw_connext/milestones{/number}","notifications_url":"https://api.github.com/repos/ros2/rmw_connext/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ros2/rmw_connext/labels{/name}","releases_url":"https://api.github.com/repos/ros2/rmw_connext/releases{/id}","created_at":"2014-08-07T21:36:18Z","updated_at":"2015-05-06T00:39:16Z","pushed_at":"2015-08-03T19:14:32Z","git_url":"git://github.com/ros2/rmw_connext.git","ssh_url":"git@github.com:ros2/rmw_connext.git","clone_url":"https://github.com/ros2/rmw_connext.git","svn_url":"https://github.com/ros2/rmw_connext","homepage":"","size":1920,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":9,"forks":0,"open_issues":9,"watchers":1,"default_branch":"master"}},"base":{"label":"ros2:master","ref":"master","sha":"68deaf5a486fe85d4f0081db5664a74d4f46d948","user":{"login":"ros2","id":3979232,"avatar_url":"https://avatars.githubusercontent.com/u/3979232?v=3","gravatar_id":"","url":"https://api.github.com/users/ros2","html_url":"https://github.com/ros2","followers_url":"https://api.github.com/users/ros2/followers","following_url":"https://api.github.com/users/ros2/following{/other_user}","gists_url":"https://api.github.com/users/ros2/gists{/gist_id}","starred_url":"https://api.github.com/users/ros2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros2/subscriptions","organizations_url":"https://api.github.com/users/ros2/orgs","repos_url":"https://api.github.com/users/ros2/repos","events_url":"https://api.github.com/users/ros2/events{/privacy}","received_events_url":"https://api.github.com/users/ros2/received_events","type":"Organization","site_admin":false},"repo":{"id":22737329,"name":"rmw_connext","full_name":"ros2/rmw_connext","owner":{"login":"ros2","id":3979232,"avatar_url":"https://avatars.githubusercontent.com/u/3979232?v=3","gravatar_id":"","url":"https://api.github.com/users/ros2","html_url":"https://github.com/ros2","followers_url":"https://api.github.com/users/ros2/followers","following_url":"https://api.github.com/users/ros2/following{/other_user}","gists_url":"https://api.github.com/users/ros2/gists{/gist_id}","starred_url":"https://api.github.com/users/ros2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ros2/subscriptions","organizations_url":"https://api.github.com/users/ros2/orgs","repos_url":"https://api.github.com/users/ros2/repos","events_url":"https://api.github.com/users/ros2/events{/privacy}","received_events_url":"https://api.github.com/users/ros2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ros2/rmw_connext","description":"Implementation of the ROS Middleware (rmw) Interface using RTI's Connext DDS.","fork":false,"url":"https://api.github.com/repos/ros2/rmw_connext","forks_url":"https://api.github.com/repos/ros2/rmw_connext/forks","keys_url":"https://api.github.com/repos/ros2/rmw_connext/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ros2/rmw_connext/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ros2/rmw_connext/teams","hooks_url":"https://api.github.com/repos/ros2/rmw_connext/hooks","issue_events_url":"https://api.github.com/repos/ros2/rmw_connext/issues/events{/number}","events_url":"https://api.github.com/repos/ros2/rmw_connext/events","assignees_url":"https://api.github.com/repos/ros2/rmw_connext/assignees{/user}","branches_url":"https://api.github.com/repos/ros2/rmw_connext/branches{/branch}","tags_url":"https://api.github.com/repos/ros2/rmw_connext/tags","blobs_url":"https://api.github.com/repos/ros2/rmw_connext/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ros2/rmw_connext/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ros2/rmw_connext/git/refs{/sha}","trees_url":"https://api.github.com/repos/ros2/rmw_connext/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ros2/rmw_connext/statuses/{sha}","languages_url":"https://api.github.com/repos/ros2/rmw_connext/languages","stargazers_url":"https://api.github.com/repos/ros2/rmw_connext/stargazers","contributors_url":"https://api.github.com/repos/ros2/rmw_connext/contributors","subscribers_url":"https://api.github.com/repos/ros2/rmw_connext/subscribers","subscription_url":"https://api.github.com/repos/ros2/rmw_connext/subscription","commits_url":"https://api.github.com/repos/ros2/rmw_connext/commits{/sha}","git_commits_url":"https://api.github.com/repos/ros2/rmw_connext/git/commits{/sha}","comments_url":"https://api.github.com/repos/ros2/rmw_connext/comments{/number}","issue_comment_url":"https://api.github.com/repos/ros2/rmw_connext/issues/comments{/number}","contents_url":"https://api.github.com/repos/ros2/rmw_connext/contents/{+path}","compare_url":"https://api.github.com/repos/ros2/rmw_connext/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ros2/rmw_connext/merges","archive_url":"https://api.github.com/repos/ros2/rmw_connext/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ros2/rmw_connext/downloads","issues_url":"https://api.github.com/repos/ros2/rmw_connext/issues{/number}","pulls_url":"https://api.github.com/repos/ros2/rmw_connext/pulls{/number}","milestones_url":"https://api.github.com/repos/ros2/rmw_connext/milestones{/number}","notifications_url":"https://api.github.com/repos/ros2/rmw_connext/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ros2/rmw_connext/labels{/name}","releases_url":"https://api.github.com/repos/ros2/rmw_connext/releases{/id}","created_at":"2014-08-07T21:36:18Z","updated_at":"2015-05-06T00:39:16Z","pushed_at":"2015-08-03T19:14:32Z","git_url":"git://github.com/ros2/rmw_connext.git","ssh_url":"git@github.com:ros2/rmw_connext.git","clone_url":"https://github.com/ros2/rmw_connext.git","svn_url":"https://github.com/ros2/rmw_connext","homepage":"","size":1920,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":9,"forks":0,"open_issues":9,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ros2/rmw_connext/pulls/65"},"html":{"href":"https://github.com/ros2/rmw_connext/pull/65"},"issue":{"href":"https://api.github.com/repos/ros2/rmw_connext/issues/65"},"comments":{"href":"https://api.github.com/repos/ros2/rmw_connext/issues/65/comments"},"review_comments":{"href":"https://api.github.com/repos/ros2/rmw_connext/pulls/65/comments"},"review_comment":{"href":"https://api.github.com/repos/ros2/rmw_connext/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ros2/rmw_connext/pulls/65/commits"},"statuses":{"href":"https://api.github.com/repos/ros2/rmw_connext/statuses/7a8256853d10af6c93684b905f68b0a64385245c"}}}}