{"action":"created","comment":{"url":"https://api.github.com/repos/cvra/msgbus/pulls/comments/181598843","pull_request_review_id":112252866,"id":181598843,"diff_hunk":"@@ -0,0 +1,68 @@\n+#include <CppUTest/TestHarness.h>\n+#include <CppUTestExt/MockSupport.h>\n+#include <memory>\n+#include \"../messagebus.h\"\n+\n+\n+TEST_GROUP(MessagebusCppInterface)\n+{\n+    messagebus_topic_t raw_topic;\n+    int topic_content;\n+    messagebus_t bus;\n+    std::unique_ptr<messagebus::TopicWrapper<int> > topic;\n+    void setup(void)\n+    {\n+        messagebus_topic_init(&raw_topic, nullptr, nullptr, &topic_content, sizeof(topic_content));\n+        messagebus_init(&bus, nullptr, nullptr);\n+        messagebus_advertise_topic(&bus, &raw_topic, \"/foo\");\n+        topic = std::make_unique<messagebus::TopicWrapper<int> >(&raw_topic);\n+    }\n+};\n+\n+TEST(MessagebusCppInterface, CanPublish)\n+{\n+    topic->publish(42);\n+\n+    int read_msg;\n+    auto res = messagebus_topic_read(&raw_topic, &read_msg, sizeof(read_msg));","path":"tests/test_cpp_interface.cpp","position":27,"original_position":27,"commit_id":"aebe222f9da39d5cee9fee1ab17988645ef24194","original_commit_id":"aebe222f9da39d5cee9fee1ab17988645ef24194","user":{"login":"SyrianSpock","id":6131403,"avatar_url":"https://avatars2.githubusercontent.com/u/6131403?v=4","gravatar_id":"","url":"https://api.github.com/users/SyrianSpock","html_url":"https://github.com/SyrianSpock","followers_url":"https://api.github.com/users/SyrianSpock/followers","following_url":"https://api.github.com/users/SyrianSpock/following{/other_user}","gists_url":"https://api.github.com/users/SyrianSpock/gists{/gist_id}","starred_url":"https://api.github.com/users/SyrianSpock/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SyrianSpock/subscriptions","organizations_url":"https://api.github.com/users/SyrianSpock/orgs","repos_url":"https://api.github.com/users/SyrianSpock/repos","events_url":"https://api.github.com/users/SyrianSpock/events{/privacy}","received_events_url":"https://api.github.com/users/SyrianSpock/received_events","type":"User","site_admin":false},"body":"I don't really like `auto` in UTs, I would use `bool res`, so we know what the function under test returns without referring to the header file (saves me two keystrokes #OptimizingMyLife).\r\n[nitpicking] Missing newline","created_at":"2018-04-15T22:07:21Z","updated_at":"2018-04-15T22:10:44Z","html_url":"https://github.com/cvra/msgbus/pull/4#discussion_r181598843","pull_request_url":"https://api.github.com/repos/cvra/msgbus/pulls/4","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/cvra/msgbus/pulls/comments/181598843"},"html":{"href":"https://github.com/cvra/msgbus/pull/4#discussion_r181598843"},"pull_request":{"href":"https://api.github.com/repos/cvra/msgbus/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/cvra/msgbus/pulls/4","id":181723468,"html_url":"https://github.com/cvra/msgbus/pull/4","diff_url":"https://github.com/cvra/msgbus/pull/4.diff","patch_url":"https://github.com/cvra/msgbus/pull/4.patch","issue_url":"https://api.github.com/repos/cvra/msgbus/issues/4","number":4,"state":"open","locked":false,"title":"Basic C++ bindings","user":{"login":"antoinealb","id":2419961,"avatar_url":"https://avatars2.githubusercontent.com/u/2419961?v=4","gravatar_id":"","url":"https://api.github.com/users/antoinealb","html_url":"https://github.com/antoinealb","followers_url":"https://api.github.com/users/antoinealb/followers","following_url":"https://api.github.com/users/antoinealb/following{/other_user}","gists_url":"https://api.github.com/users/antoinealb/gists{/gist_id}","starred_url":"https://api.github.com/users/antoinealb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antoinealb/subscriptions","organizations_url":"https://api.github.com/users/antoinealb/orgs","repos_url":"https://api.github.com/users/antoinealb/repos","events_url":"https://api.github.com/users/antoinealb/events{/privacy}","received_events_url":"https://api.github.com/users/antoinealb/received_events","type":"User","site_admin":false},"body":"This PR implements basic C++ wrappers for messagebus topics.\r\nIt does not intent on replacing the existing C code but simply wrapping it into a C++ class to be (more) type safe.\r\nThe API also becomes *much* less verbose:\r\n\r\n```cpp\r\n// Old style C API\r\nPoint msg = {10, 10};\r\nmessagebus_topic_t *topic = messagebus_find_topic_blocking(&bus, \"/foobar\");\r\nmessagebus_topic_publish(topic, &msg, sizeof(msg));\r\n\r\n// New style C++ API\r\nauto topic = messagebus::find_topic_blocking<Point>(bus, \"/foobar\");\r\ntopic.publish({10, 10});\r\n```\r\n\r\nI do not know if it is ready for CVRA production though. I plan to use it for Hydrocontest, but haven't tested it \"live\" already.\r\n\r\nSince this does not change the underlying C implementation, it can allow c++ module and c modules to communicate. This approach could work for Rust if we someday decide to use it.\r\n","created_at":"2018-04-15T21:59:46Z","updated_at":"2018-04-15T22:10:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e32414a85d0715346df2b816eb9e3c23155cabbf","assignee":{"login":"antoinealb","id":2419961,"avatar_url":"https://avatars2.githubusercontent.com/u/2419961?v=4","gravatar_id":"","url":"https://api.github.com/users/antoinealb","html_url":"https://github.com/antoinealb","followers_url":"https://api.github.com/users/antoinealb/followers","following_url":"https://api.github.com/users/antoinealb/following{/other_user}","gists_url":"https://api.github.com/users/antoinealb/gists{/gist_id}","starred_url":"https://api.github.com/users/antoinealb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antoinealb/subscriptions","organizations_url":"https://api.github.com/users/antoinealb/orgs","repos_url":"https://api.github.com/users/antoinealb/repos","events_url":"https://api.github.com/users/antoinealb/events{/privacy}","received_events_url":"https://api.github.com/users/antoinealb/received_events","type":"User","site_admin":false},"assignees":[{"login":"antoinealb","id":2419961,"avatar_url":"https://avatars2.githubusercontent.com/u/2419961?v=4","gravatar_id":"","url":"https://api.github.com/users/antoinealb","html_url":"https://github.com/antoinealb","followers_url":"https://api.github.com/users/antoinealb/followers","following_url":"https://api.github.com/users/antoinealb/following{/other_user}","gists_url":"https://api.github.com/users/antoinealb/gists{/gist_id}","starred_url":"https://api.github.com/users/antoinealb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antoinealb/subscriptions","organizations_url":"https://api.github.com/users/antoinealb/orgs","repos_url":"https://api.github.com/users/antoinealb/repos","events_url":"https://api.github.com/users/antoinealb/events{/privacy}","received_events_url":"https://api.github.com/users/antoinealb/received_events","type":"User","site_admin":false},{"login":"nuft","id":7102039,"avatar_url":"https://avatars0.githubusercontent.com/u/7102039?v=4","gravatar_id":"","url":"https://api.github.com/users/nuft","html_url":"https://github.com/nuft","followers_url":"https://api.github.com/users/nuft/followers","following_url":"https://api.github.com/users/nuft/following{/other_user}","gists_url":"https://api.github.com/users/nuft/gists{/gist_id}","starred_url":"https://api.github.com/users/nuft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nuft/subscriptions","organizations_url":"https://api.github.com/users/nuft/orgs","repos_url":"https://api.github.com/users/nuft/repos","events_url":"https://api.github.com/users/nuft/events{/privacy}","received_events_url":"https://api.github.com/users/nuft/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/cvra/msgbus/pulls/4/commits","review_comments_url":"https://api.github.com/repos/cvra/msgbus/pulls/4/comments","review_comment_url":"https://api.github.com/repos/cvra/msgbus/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cvra/msgbus/issues/4/comments","statuses_url":"https://api.github.com/repos/cvra/msgbus/statuses/aebe222f9da39d5cee9fee1ab17988645ef24194","head":{"label":"cvra:cpp-interface","ref":"cpp-interface","sha":"aebe222f9da39d5cee9fee1ab17988645ef24194","user":{"login":"cvra","id":5530328,"avatar_url":"https://avatars3.githubusercontent.com/u/5530328?v=4","gravatar_id":"","url":"https://api.github.com/users/cvra","html_url":"https://github.com/cvra","followers_url":"https://api.github.com/users/cvra/followers","following_url":"https://api.github.com/users/cvra/following{/other_user}","gists_url":"https://api.github.com/users/cvra/gists{/gist_id}","starred_url":"https://api.github.com/users/cvra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cvra/subscriptions","organizations_url":"https://api.github.com/users/cvra/orgs","repos_url":"https://api.github.com/users/cvra/repos","events_url":"https://api.github.com/users/cvra/events{/privacy}","received_events_url":"https://api.github.com/users/cvra/received_events","type":"Organization","site_admin":false},"repo":{"id":60977569,"name":"msgbus","full_name":"cvra/msgbus","owner":{"login":"cvra","id":5530328,"avatar_url":"https://avatars3.githubusercontent.com/u/5530328?v=4","gravatar_id":"","url":"https://api.github.com/users/cvra","html_url":"https://github.com/cvra","followers_url":"https://api.github.com/users/cvra/followers","following_url":"https://api.github.com/users/cvra/following{/other_user}","gists_url":"https://api.github.com/users/cvra/gists{/gist_id}","starred_url":"https://api.github.com/users/cvra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cvra/subscriptions","organizations_url":"https://api.github.com/users/cvra/orgs","repos_url":"https://api.github.com/users/cvra/repos","events_url":"https://api.github.com/users/cvra/events{/privacy}","received_events_url":"https://api.github.com/users/cvra/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cvra/msgbus","description":"Microcontroller message bus","fork":false,"url":"https://api.github.com/repos/cvra/msgbus","forks_url":"https://api.github.com/repos/cvra/msgbus/forks","keys_url":"https://api.github.com/repos/cvra/msgbus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cvra/msgbus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cvra/msgbus/teams","hooks_url":"https://api.github.com/repos/cvra/msgbus/hooks","issue_events_url":"https://api.github.com/repos/cvra/msgbus/issues/events{/number}","events_url":"https://api.github.com/repos/cvra/msgbus/events","assignees_url":"https://api.github.com/repos/cvra/msgbus/assignees{/user}","branches_url":"https://api.github.com/repos/cvra/msgbus/branches{/branch}","tags_url":"https://api.github.com/repos/cvra/msgbus/tags","blobs_url":"https://api.github.com/repos/cvra/msgbus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cvra/msgbus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cvra/msgbus/git/refs{/sha}","trees_url":"https://api.github.com/repos/cvra/msgbus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cvra/msgbus/statuses/{sha}","languages_url":"https://api.github.com/repos/cvra/msgbus/languages","stargazers_url":"https://api.github.com/repos/cvra/msgbus/stargazers","contributors_url":"https://api.github.com/repos/cvra/msgbus/contributors","subscribers_url":"https://api.github.com/repos/cvra/msgbus/subscribers","subscription_url":"https://api.github.com/repos/cvra/msgbus/subscription","commits_url":"https://api.github.com/repos/cvra/msgbus/commits{/sha}","git_commits_url":"https://api.github.com/repos/cvra/msgbus/git/commits{/sha}","comments_url":"https://api.github.com/repos/cvra/msgbus/comments{/number}","issue_comment_url":"https://api.github.com/repos/cvra/msgbus/issues/comments{/number}","contents_url":"https://api.github.com/repos/cvra/msgbus/contents/{+path}","compare_url":"https://api.github.com/repos/cvra/msgbus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cvra/msgbus/merges","archive_url":"https://api.github.com/repos/cvra/msgbus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cvra/msgbus/downloads","issues_url":"https://api.github.com/repos/cvra/msgbus/issues{/number}","pulls_url":"https://api.github.com/repos/cvra/msgbus/pulls{/number}","milestones_url":"https://api.github.com/repos/cvra/msgbus/milestones{/number}","notifications_url":"https://api.github.com/repos/cvra/msgbus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cvra/msgbus/labels{/name}","releases_url":"https://api.github.com/repos/cvra/msgbus/releases{/id}","deployments_url":"https://api.github.com/repos/cvra/msgbus/deployments","created_at":"2016-06-12T16:35:02Z","updated_at":"2018-04-15T22:04:47Z","pushed_at":"2018-04-15T22:04:57Z","git_url":"git://github.com/cvra/msgbus.git","ssh_url":"git@github.com:cvra/msgbus.git","clone_url":"https://github.com/cvra/msgbus.git","svn_url":"https://github.com/cvra/msgbus","homepage":"","size":46,"stargazers_count":2,"watchers_count":2,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":4,"open_issues":1,"watchers":2,"default_branch":"master"}},"base":{"label":"cvra:master","ref":"master","sha":"ff37d978623ecdb0876a611f19c43d86def7665c","user":{"login":"cvra","id":5530328,"avatar_url":"https://avatars3.githubusercontent.com/u/5530328?v=4","gravatar_id":"","url":"https://api.github.com/users/cvra","html_url":"https://github.com/cvra","followers_url":"https://api.github.com/users/cvra/followers","following_url":"https://api.github.com/users/cvra/following{/other_user}","gists_url":"https://api.github.com/users/cvra/gists{/gist_id}","starred_url":"https://api.github.com/users/cvra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cvra/subscriptions","organizations_url":"https://api.github.com/users/cvra/orgs","repos_url":"https://api.github.com/users/cvra/repos","events_url":"https://api.github.com/users/cvra/events{/privacy}","received_events_url":"https://api.github.com/users/cvra/received_events","type":"Organization","site_admin":false},"repo":{"id":60977569,"name":"msgbus","full_name":"cvra/msgbus","owner":{"login":"cvra","id":5530328,"avatar_url":"https://avatars3.githubusercontent.com/u/5530328?v=4","gravatar_id":"","url":"https://api.github.com/users/cvra","html_url":"https://github.com/cvra","followers_url":"https://api.github.com/users/cvra/followers","following_url":"https://api.github.com/users/cvra/following{/other_user}","gists_url":"https://api.github.com/users/cvra/gists{/gist_id}","starred_url":"https://api.github.com/users/cvra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cvra/subscriptions","organizations_url":"https://api.github.com/users/cvra/orgs","repos_url":"https://api.github.com/users/cvra/repos","events_url":"https://api.github.com/users/cvra/events{/privacy}","received_events_url":"https://api.github.com/users/cvra/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cvra/msgbus","description":"Microcontroller message bus","fork":false,"url":"https://api.github.com/repos/cvra/msgbus","forks_url":"https://api.github.com/repos/cvra/msgbus/forks","keys_url":"https://api.github.com/repos/cvra/msgbus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cvra/msgbus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cvra/msgbus/teams","hooks_url":"https://api.github.com/repos/cvra/msgbus/hooks","issue_events_url":"https://api.github.com/repos/cvra/msgbus/issues/events{/number}","events_url":"https://api.github.com/repos/cvra/msgbus/events","assignees_url":"https://api.github.com/repos/cvra/msgbus/assignees{/user}","branches_url":"https://api.github.com/repos/cvra/msgbus/branches{/branch}","tags_url":"https://api.github.com/repos/cvra/msgbus/tags","blobs_url":"https://api.github.com/repos/cvra/msgbus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cvra/msgbus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cvra/msgbus/git/refs{/sha}","trees_url":"https://api.github.com/repos/cvra/msgbus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cvra/msgbus/statuses/{sha}","languages_url":"https://api.github.com/repos/cvra/msgbus/languages","stargazers_url":"https://api.github.com/repos/cvra/msgbus/stargazers","contributors_url":"https://api.github.com/repos/cvra/msgbus/contributors","subscribers_url":"https://api.github.com/repos/cvra/msgbus/subscribers","subscription_url":"https://api.github.com/repos/cvra/msgbus/subscription","commits_url":"https://api.github.com/repos/cvra/msgbus/commits{/sha}","git_commits_url":"https://api.github.com/repos/cvra/msgbus/git/commits{/sha}","comments_url":"https://api.github.com/repos/cvra/msgbus/comments{/number}","issue_comment_url":"https://api.github.com/repos/cvra/msgbus/issues/comments{/number}","contents_url":"https://api.github.com/repos/cvra/msgbus/contents/{+path}","compare_url":"https://api.github.com/repos/cvra/msgbus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cvra/msgbus/merges","archive_url":"https://api.github.com/repos/cvra/msgbus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cvra/msgbus/downloads","issues_url":"https://api.github.com/repos/cvra/msgbus/issues{/number}","pulls_url":"https://api.github.com/repos/cvra/msgbus/pulls{/number}","milestones_url":"https://api.github.com/repos/cvra/msgbus/milestones{/number}","notifications_url":"https://api.github.com/repos/cvra/msgbus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cvra/msgbus/labels{/name}","releases_url":"https://api.github.com/repos/cvra/msgbus/releases{/id}","deployments_url":"https://api.github.com/repos/cvra/msgbus/deployments","created_at":"2016-06-12T16:35:02Z","updated_at":"2018-04-15T22:04:47Z","pushed_at":"2018-04-15T22:04:57Z","git_url":"git://github.com/cvra/msgbus.git","ssh_url":"git@github.com:cvra/msgbus.git","clone_url":"https://github.com/cvra/msgbus.git","svn_url":"https://github.com/cvra/msgbus","homepage":"","size":46,"stargazers_count":2,"watchers_count":2,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":1,"license":null,"forks":4,"open_issues":1,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cvra/msgbus/pulls/4"},"html":{"href":"https://github.com/cvra/msgbus/pull/4"},"issue":{"href":"https://api.github.com/repos/cvra/msgbus/issues/4"},"comments":{"href":"https://api.github.com/repos/cvra/msgbus/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/cvra/msgbus/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/cvra/msgbus/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cvra/msgbus/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/cvra/msgbus/statuses/aebe222f9da39d5cee9fee1ab17988645ef24194"}},"author_association":"OWNER"}}
{"actor":{"display_login":"SyrianSpock"}}