{"action":"created","comment":{"url":"https://api.github.com/repos/ros2/design/pulls/comments/32565573","id":32565573,"diff_hunk":"@@ -0,0 +1,132 @@\n+---\n+layout: default\n+title: Generated C++ interfaces\n+permalink: articles/generated_interfaces_cpp.html\n+abstract:\n+  This article describes the generated C++ code for ROS 2 interfaces.\n+author: '[Dirk Thomas](https://github.com/dirk-thomas)'\n+---\n+\n+* This will become a table of contents (this text will be scraped).\n+{:toc}\n+\n+# {{ page.title }}\n+\n+<div class=\"abstract\" markdown=\"1\">\n+{{ page.abstract }}\n+</div>\n+\n+Original Author: {{ page.author }}\n+\n+\n+## Scope\n+\n+This article specifies the generated C++ code for ROS interface types defined in the [interface definition article](interface_definition.html).\n+\n+\n+## Namespacing\n+\n+All code of a ROS package should be defined in a namespace named after the package.\n+To separate the generated code from other code within the package it is defined in a sub namespace:\n+* namespace for ROS messages: `package_name::msg`.\n+* namespace for ROS services: `package_name::srv`.\n+\n+\n+## Generated files\n+\n+Following the C++ style guide of ROS 2 the namespace hierarchy is mapped to a folder structure.\n+The filenames use lowercase alphanumeric characters with underscores for separating words and end with either `.hpp` or `.cpp`.\n+\n+<div class=\"alert alert-warning\" markdown=\"1\">\n+  <b>TODO:</b> describe separate header files\n+</div>\n+\n+\n+### Messages\n+\n+A message results in a templated `struct` with the same name followed by an underscore.\n+The single template argument is the allocator for the data structure.\n+\n+For ease of use there is a `typedef` with the same name as the message which uses a default allocator (e.g. `std::allocator`).\n+\n+\n+#### Members\n+\n+The struct has same-named member variables for every field of the message.\n+For each field a `typedef` is created which is named after the member with a leading underscore and a trailing `_type`.\n+\n+\n+#### Constants\n+\n+Numeric constants are defined as `enums` within the struct.\n+\n+All other constants are declared as `static const` members in the struct and their values are defined outside of the struct.\n+\n+\n+#### Getters\n+\n+<div class=\"alert alert-warning\" markdown=\"1\">\n+  <b>TODO:</b> const and non-const getters\n+</div>\n+\n+\n+#### Setters\n+\n+Beside the direct access to the member variables for each member a *setter* method is generated.\n+They are named after the members with a leading `set_`.\n+The setter methods have a single argument to pass the value for the member variable.\n+Each setter methods returns the struct itself to enable (method chaining)[https://isocpp.org/wiki/faq/ctors#named-parameter-idiom}.","path":"articles/112_generated_interfaces_cpp.md","position":78,"original_position":78,"commit_id":"2bf6fdc26741a5af8c5215c4b408893d9d7731c1","original_commit_id":"2bf6fdc26741a5af8c5215c4b408893d9d7731c1","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":"This should be closed with a `]` not a `}`.","created_at":"2015-06-16T20:17:15Z","updated_at":"2015-06-16T20:17:15Z","html_url":"https://github.com/ros2/design/pull/33#discussion_r32565573","pull_request_url":"https://api.github.com/repos/ros2/design/pulls/33","_links":{"self":{"href":"https://api.github.com/repos/ros2/design/pulls/comments/32565573"},"html":{"href":"https://github.com/ros2/design/pull/33#discussion_r32565573"},"pull_request":{"href":"https://api.github.com/repos/ros2/design/pulls/33"}}},"pull_request":{"url":"https://api.github.com/repos/ros2/design/pulls/33","id":37835563,"html_url":"https://github.com/ros2/design/pull/33","diff_url":"https://github.com/ros2/design/pull/33.diff","patch_url":"https://github.com/ros2/design/pull/33.patch","issue_url":"https://api.github.com/repos/ros2/design/issues/33","number":33,"state":"open","locked":false,"title":"add article about generated C++ interfaces","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":"","created_at":"2015-06-16T20:07:03Z","updated_at":"2015-06-16T20:17:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d021a80fd4dfcc89aedf9dcd0857f88ace17c812","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/design/pulls/33/commits","review_comments_url":"https://api.github.com/repos/ros2/design/pulls/33/comments","review_comment_url":"https://api.github.com/repos/ros2/design/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ros2/design/issues/33/comments","statuses_url":"https://api.github.com/repos/ros2/design/statuses/2bf6fdc26741a5af8c5215c4b408893d9d7731c1","head":{"label":"ros2:generated_cpp_interfaces","ref":"generated_cpp_interfaces","sha":"2bf6fdc26741a5af8c5215c4b408893d9d7731c1","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":14241623,"name":"design","full_name":"ros2/design","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/design","description":"Design documentation for ROS 2.0 effort","fork":false,"url":"https://api.github.com/repos/ros2/design","forks_url":"https://api.github.com/repos/ros2/design/forks","keys_url":"https://api.github.com/repos/ros2/design/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ros2/design/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ros2/design/teams","hooks_url":"https://api.github.com/repos/ros2/design/hooks","issue_events_url":"https://api.github.com/repos/ros2/design/issues/events{/number}","events_url":"https://api.github.com/repos/ros2/design/events","assignees_url":"https://api.github.com/repos/ros2/design/assignees{/user}","branches_url":"https://api.github.com/repos/ros2/design/branches{/branch}","tags_url":"https://api.github.com/repos/ros2/design/tags","blobs_url":"https://api.github.com/repos/ros2/design/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ros2/design/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ros2/design/git/refs{/sha}","trees_url":"https://api.github.com/repos/ros2/design/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ros2/design/statuses/{sha}","languages_url":"https://api.github.com/repos/ros2/design/languages","stargazers_url":"https://api.github.com/repos/ros2/design/stargazers","contributors_url":"https://api.github.com/repos/ros2/design/contributors","subscribers_url":"https://api.github.com/repos/ros2/design/subscribers","subscription_url":"https://api.github.com/repos/ros2/design/subscription","commits_url":"https://api.github.com/repos/ros2/design/commits{/sha}","git_commits_url":"https://api.github.com/repos/ros2/design/git/commits{/sha}","comments_url":"https://api.github.com/repos/ros2/design/comments{/number}","issue_comment_url":"https://api.github.com/repos/ros2/design/issues/comments{/number}","contents_url":"https://api.github.com/repos/ros2/design/contents/{+path}","compare_url":"https://api.github.com/repos/ros2/design/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ros2/design/merges","archive_url":"https://api.github.com/repos/ros2/design/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ros2/design/downloads","issues_url":"https://api.github.com/repos/ros2/design/issues{/number}","pulls_url":"https://api.github.com/repos/ros2/design/pulls{/number}","milestones_url":"https://api.github.com/repos/ros2/design/milestones{/number}","notifications_url":"https://api.github.com/repos/ros2/design/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ros2/design/labels{/name}","releases_url":"https://api.github.com/repos/ros2/design/releases{/id}","created_at":"2013-11-08T18:56:29Z","updated_at":"2015-06-12T21:16:40Z","pushed_at":"2015-06-16T20:07:04Z","git_url":"git://github.com/ros2/design.git","ssh_url":"git@github.com:ros2/design.git","clone_url":"https://github.com/ros2/design.git","svn_url":"https://github.com/ros2/design","homepage":"http://design.ros2.org/","size":1724,"stargazers_count":13,"watchers_count":13,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":16,"mirror_url":null,"open_issues_count":8,"forks":16,"open_issues":8,"watchers":13,"default_branch":"gh-pages"}},"base":{"label":"ros2:gh-pages","ref":"gh-pages","sha":"a89968db9645a9c29288466d13b0bba09007ef55","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":14241623,"name":"design","full_name":"ros2/design","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/design","description":"Design documentation for ROS 2.0 effort","fork":false,"url":"https://api.github.com/repos/ros2/design","forks_url":"https://api.github.com/repos/ros2/design/forks","keys_url":"https://api.github.com/repos/ros2/design/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ros2/design/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ros2/design/teams","hooks_url":"https://api.github.com/repos/ros2/design/hooks","issue_events_url":"https://api.github.com/repos/ros2/design/issues/events{/number}","events_url":"https://api.github.com/repos/ros2/design/events","assignees_url":"https://api.github.com/repos/ros2/design/assignees{/user}","branches_url":"https://api.github.com/repos/ros2/design/branches{/branch}","tags_url":"https://api.github.com/repos/ros2/design/tags","blobs_url":"https://api.github.com/repos/ros2/design/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ros2/design/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ros2/design/git/refs{/sha}","trees_url":"https://api.github.com/repos/ros2/design/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ros2/design/statuses/{sha}","languages_url":"https://api.github.com/repos/ros2/design/languages","stargazers_url":"https://api.github.com/repos/ros2/design/stargazers","contributors_url":"https://api.github.com/repos/ros2/design/contributors","subscribers_url":"https://api.github.com/repos/ros2/design/subscribers","subscription_url":"https://api.github.com/repos/ros2/design/subscription","commits_url":"https://api.github.com/repos/ros2/design/commits{/sha}","git_commits_url":"https://api.github.com/repos/ros2/design/git/commits{/sha}","comments_url":"https://api.github.com/repos/ros2/design/comments{/number}","issue_comment_url":"https://api.github.com/repos/ros2/design/issues/comments{/number}","contents_url":"https://api.github.com/repos/ros2/design/contents/{+path}","compare_url":"https://api.github.com/repos/ros2/design/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ros2/design/merges","archive_url":"https://api.github.com/repos/ros2/design/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ros2/design/downloads","issues_url":"https://api.github.com/repos/ros2/design/issues{/number}","pulls_url":"https://api.github.com/repos/ros2/design/pulls{/number}","milestones_url":"https://api.github.com/repos/ros2/design/milestones{/number}","notifications_url":"https://api.github.com/repos/ros2/design/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ros2/design/labels{/name}","releases_url":"https://api.github.com/repos/ros2/design/releases{/id}","created_at":"2013-11-08T18:56:29Z","updated_at":"2015-06-12T21:16:40Z","pushed_at":"2015-06-16T20:07:04Z","git_url":"git://github.com/ros2/design.git","ssh_url":"git@github.com:ros2/design.git","clone_url":"https://github.com/ros2/design.git","svn_url":"https://github.com/ros2/design","homepage":"http://design.ros2.org/","size":1724,"stargazers_count":13,"watchers_count":13,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":16,"mirror_url":null,"open_issues_count":8,"forks":16,"open_issues":8,"watchers":13,"default_branch":"gh-pages"}},"_links":{"self":{"href":"https://api.github.com/repos/ros2/design/pulls/33"},"html":{"href":"https://github.com/ros2/design/pull/33"},"issue":{"href":"https://api.github.com/repos/ros2/design/issues/33"},"comments":{"href":"https://api.github.com/repos/ros2/design/issues/33/comments"},"review_comments":{"href":"https://api.github.com/repos/ros2/design/pulls/33/comments"},"review_comment":{"href":"https://api.github.com/repos/ros2/design/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ros2/design/pulls/33/commits"},"statuses":{"href":"https://api.github.com/repos/ros2/design/statuses/2bf6fdc26741a5af8c5215c4b408893d9d7731c1"}}}}