{"action":"created","comment":{"url":"https://api.github.com/repos/ros2/examples/pulls/comments/43798065","id":43798065,"diff_hunk":"@@ -16,20 +16,36 @@\n \n #include \"rclcpp/rclcpp.hpp\"\n \n-void on_parameter_event(const rcl_interfaces::msg::ParameterEvent::SharedPtr event)\n+void on_parameter_event(\n+  const std::set<std::string> & expected_new_parameters,\n+  const std::set<std::string> & expected_changed_parameters,\n+  const std::set<std::string> & expected_deleted_parameters,\n+  std::set<std::string> & received_new_parameters,\n+  std::set<std::string> & received_changed_parameters,\n+  std::set<std::string> & received_deleted_parameters,\n+  const rcl_interfaces::msg::ParameterEvent::SharedPtr event)\n {\n   // TODO(wjwwood): The message should have an operator<<, which would replace all of this.\n   std::cout << \"Parameter event:\" << std::endl << \" new parameters:\" << std::endl;\n   for (auto & new_parameter : event->new_parameters) {\n     std::cout << \"  \" << new_parameter.name << std::endl;\n+    received_new_parameters.insert(new_parameter.name);\n   }\n   std::cout << \" changed parameters:\" << std::endl;\n   for (auto & changed_parameter : event->changed_parameters) {\n     std::cout << \"  \" << changed_parameter.name << std::endl;\n+    received_changed_parameters.insert(changed_parameter.name);\n   }\n   std::cout << \" deleted parameters:\" << std::endl;\n   for (auto & deleted_parameter : event->deleted_parameters) {\n     std::cout << \"  \" << deleted_parameter.name << std::endl;\n+    received_deleted_parameters.insert(deleted_parameter.name);\n+  }\n+\n+  if (expected_new_parameters == received_new_parameters &&\n+    expected_changed_parameters == received_changed_parameters &&\n+    expected_deleted_parameters == received_deleted_parameters) {","path":"rclcpp_examples/src/parameters/parameter_events_async.cpp","position":null,"original_position":33,"commit_id":"92b2adfe61645cc30f8ca42ecc099c25757028f3","original_commit_id":"d4aa7e9cef1f7ffcf9677cf90f82f7c80d6a8d7c","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'd do this:\r\n\r\n```c++\r\nif (expected_new_parameters == received_new_parameters &&\r\n    expected_changed_parameters == received_changed_parameters &&\r\n    expected_deleted_parameters == received_deleted_parameters)\r\n{\r\n  // ...\r\n}\r\n```\r\n\r\nOr this:\r\n\r\n```c++\r\nif (\r\n  expected_new_parameters == received_new_parameters &&\r\n  expected_changed_parameters == received_changed_parameters &&\r\n  expected_deleted_parameters == received_deleted_parameters)\r\n{\r\n  // ...\r\n}\r\n```\r\n\r\nBut frankly multiline conditionals within if statements are just ugly (in C++ and Python).","created_at":"2015-11-03T19:51:39Z","updated_at":"2015-11-03T19:51:39Z","html_url":"https://github.com/ros2/examples/pull/69#discussion_r43798065","pull_request_url":"https://api.github.com/repos/ros2/examples/pulls/69","_links":{"self":{"href":"https://api.github.com/repos/ros2/examples/pulls/comments/43798065"},"html":{"href":"https://github.com/ros2/examples/pull/69#discussion_r43798065"},"pull_request":{"href":"https://api.github.com/repos/ros2/examples/pulls/69"}}},"pull_request":{"url":"https://api.github.com/repos/ros2/examples/pulls/69","id":49596708,"html_url":"https://github.com/ros2/examples/pull/69","diff_url":"https://github.com/ros2/examples/pull/69.diff","patch_url":"https://github.com/ros2/examples/pull/69.patch","issue_url":"https://api.github.com/repos/ros2/examples/issues/69","number":69,"state":"open","locked":false,"title":"Ensure that the on_parameter_event subscription in triggered","user":{"login":"esteve","id":33620,"avatar_url":"https://avatars.githubusercontent.com/u/33620?v=3","gravatar_id":"","url":"https://api.github.com/users/esteve","html_url":"https://github.com/esteve","followers_url":"https://api.github.com/users/esteve/followers","following_url":"https://api.github.com/users/esteve/following{/other_user}","gists_url":"https://api.github.com/users/esteve/gists{/gist_id}","starred_url":"https://api.github.com/users/esteve/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esteve/subscriptions","organizations_url":"https://api.github.com/users/esteve/orgs","repos_url":"https://api.github.com/users/esteve/repos","events_url":"https://api.github.com/users/esteve/events{/privacy}","received_events_url":"https://api.github.com/users/esteve/received_events","type":"User","site_admin":false},"body":"This should report all the parameter events.","created_at":"2015-11-03T19:02:18Z","updated_at":"2015-11-03T19:51:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e4dec19869559108e54a7e2ba1b31b77d83e1566","assignee":{"login":"esteve","id":33620,"avatar_url":"https://avatars.githubusercontent.com/u/33620?v=3","gravatar_id":"","url":"https://api.github.com/users/esteve","html_url":"https://github.com/esteve","followers_url":"https://api.github.com/users/esteve/followers","following_url":"https://api.github.com/users/esteve/following{/other_user}","gists_url":"https://api.github.com/users/esteve/gists{/gist_id}","starred_url":"https://api.github.com/users/esteve/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/esteve/subscriptions","organizations_url":"https://api.github.com/users/esteve/orgs","repos_url":"https://api.github.com/users/esteve/repos","events_url":"https://api.github.com/users/esteve/events{/privacy}","received_events_url":"https://api.github.com/users/esteve/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/ros2/examples/pulls/69/commits","review_comments_url":"https://api.github.com/repos/ros2/examples/pulls/69/comments","review_comment_url":"https://api.github.com/repos/ros2/examples/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ros2/examples/issues/69/comments","statuses_url":"https://api.github.com/repos/ros2/examples/statuses/92b2adfe61645cc30f8ca42ecc099c25757028f3","head":{"label":"ros2:changed-parameters","ref":"changed-parameters","sha":"92b2adfe61645cc30f8ca42ecc099c25757028f3","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":21909749,"name":"examples","full_name":"ros2/examples","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/examples","description":"Example packages for ROS2","fork":false,"url":"https://api.github.com/repos/ros2/examples","forks_url":"https://api.github.com/repos/ros2/examples/forks","keys_url":"https://api.github.com/repos/ros2/examples/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ros2/examples/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ros2/examples/teams","hooks_url":"https://api.github.com/repos/ros2/examples/hooks","issue_events_url":"https://api.github.com/repos/ros2/examples/issues/events{/number}","events_url":"https://api.github.com/repos/ros2/examples/events","assignees_url":"https://api.github.com/repos/ros2/examples/assignees{/user}","branches_url":"https://api.github.com/repos/ros2/examples/branches{/branch}","tags_url":"https://api.github.com/repos/ros2/examples/tags","blobs_url":"https://api.github.com/repos/ros2/examples/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ros2/examples/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ros2/examples/git/refs{/sha}","trees_url":"https://api.github.com/repos/ros2/examples/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ros2/examples/statuses/{sha}","languages_url":"https://api.github.com/repos/ros2/examples/languages","stargazers_url":"https://api.github.com/repos/ros2/examples/stargazers","contributors_url":"https://api.github.com/repos/ros2/examples/contributors","subscribers_url":"https://api.github.com/repos/ros2/examples/subscribers","subscription_url":"https://api.github.com/repos/ros2/examples/subscription","commits_url":"https://api.github.com/repos/ros2/examples/commits{/sha}","git_commits_url":"https://api.github.com/repos/ros2/examples/git/commits{/sha}","comments_url":"https://api.github.com/repos/ros2/examples/comments{/number}","issue_comment_url":"https://api.github.com/repos/ros2/examples/issues/comments{/number}","contents_url":"https://api.github.com/repos/ros2/examples/contents/{+path}","compare_url":"https://api.github.com/repos/ros2/examples/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ros2/examples/merges","archive_url":"https://api.github.com/repos/ros2/examples/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ros2/examples/downloads","issues_url":"https://api.github.com/repos/ros2/examples/issues{/number}","pulls_url":"https://api.github.com/repos/ros2/examples/pulls{/number}","milestones_url":"https://api.github.com/repos/ros2/examples/milestones{/number}","notifications_url":"https://api.github.com/repos/ros2/examples/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ros2/examples/labels{/name}","releases_url":"https://api.github.com/repos/ros2/examples/releases{/id}","created_at":"2014-07-16T17:11:20Z","updated_at":"2015-10-05T20:56:53Z","pushed_at":"2015-11-03T19:51:08Z","git_url":"git://github.com/ros2/examples.git","ssh_url":"git@github.com:ros2/examples.git","clone_url":"https://github.com/ros2/examples.git","svn_url":"https://github.com/ros2/examples","homepage":"https://github.com/ros2/examples/wiki","size":1553,"stargazers_count":13,"watchers_count":13,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":13,"default_branch":"master"}},"base":{"label":"ros2:master","ref":"master","sha":"17a3bd0f36096162d453c931f95edb42014bf019","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":21909749,"name":"examples","full_name":"ros2/examples","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/examples","description":"Example packages for ROS2","fork":false,"url":"https://api.github.com/repos/ros2/examples","forks_url":"https://api.github.com/repos/ros2/examples/forks","keys_url":"https://api.github.com/repos/ros2/examples/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ros2/examples/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ros2/examples/teams","hooks_url":"https://api.github.com/repos/ros2/examples/hooks","issue_events_url":"https://api.github.com/repos/ros2/examples/issues/events{/number}","events_url":"https://api.github.com/repos/ros2/examples/events","assignees_url":"https://api.github.com/repos/ros2/examples/assignees{/user}","branches_url":"https://api.github.com/repos/ros2/examples/branches{/branch}","tags_url":"https://api.github.com/repos/ros2/examples/tags","blobs_url":"https://api.github.com/repos/ros2/examples/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ros2/examples/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ros2/examples/git/refs{/sha}","trees_url":"https://api.github.com/repos/ros2/examples/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ros2/examples/statuses/{sha}","languages_url":"https://api.github.com/repos/ros2/examples/languages","stargazers_url":"https://api.github.com/repos/ros2/examples/stargazers","contributors_url":"https://api.github.com/repos/ros2/examples/contributors","subscribers_url":"https://api.github.com/repos/ros2/examples/subscribers","subscription_url":"https://api.github.com/repos/ros2/examples/subscription","commits_url":"https://api.github.com/repos/ros2/examples/commits{/sha}","git_commits_url":"https://api.github.com/repos/ros2/examples/git/commits{/sha}","comments_url":"https://api.github.com/repos/ros2/examples/comments{/number}","issue_comment_url":"https://api.github.com/repos/ros2/examples/issues/comments{/number}","contents_url":"https://api.github.com/repos/ros2/examples/contents/{+path}","compare_url":"https://api.github.com/repos/ros2/examples/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ros2/examples/merges","archive_url":"https://api.github.com/repos/ros2/examples/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ros2/examples/downloads","issues_url":"https://api.github.com/repos/ros2/examples/issues{/number}","pulls_url":"https://api.github.com/repos/ros2/examples/pulls{/number}","milestones_url":"https://api.github.com/repos/ros2/examples/milestones{/number}","notifications_url":"https://api.github.com/repos/ros2/examples/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ros2/examples/labels{/name}","releases_url":"https://api.github.com/repos/ros2/examples/releases{/id}","created_at":"2014-07-16T17:11:20Z","updated_at":"2015-10-05T20:56:53Z","pushed_at":"2015-11-03T19:51:08Z","git_url":"git://github.com/ros2/examples.git","ssh_url":"git@github.com:ros2/examples.git","clone_url":"https://github.com/ros2/examples.git","svn_url":"https://github.com/ros2/examples","homepage":"https://github.com/ros2/examples/wiki","size":1553,"stargazers_count":13,"watchers_count":13,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ros2/examples/pulls/69"},"html":{"href":"https://github.com/ros2/examples/pull/69"},"issue":{"href":"https://api.github.com/repos/ros2/examples/issues/69"},"comments":{"href":"https://api.github.com/repos/ros2/examples/issues/69/comments"},"review_comments":{"href":"https://api.github.com/repos/ros2/examples/pulls/69/comments"},"review_comment":{"href":"https://api.github.com/repos/ros2/examples/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ros2/examples/pulls/69/commits"},"statuses":{"href":"https://api.github.com/repos/ros2/examples/statuses/92b2adfe61645cc30f8ca42ecc099c25757028f3"}}}}