{"action":"created","issue":{"url":"https://api.github.com/repos/ros/ros_comm/issues/1000","repository_url":"https://api.github.com/repos/ros/ros_comm","labels_url":"https://api.github.com/repos/ros/ros_comm/issues/1000/labels{/name}","comments_url":"https://api.github.com/repos/ros/ros_comm/issues/1000/comments","events_url":"https://api.github.com/repos/ros/ros_comm/issues/1000/events","html_url":"https://github.com/ros/ros_comm/pull/1000","id":210232975,"number":1000,"title":"Made copying rosbag::Bag a compiler error to prevent crashes and added a swap function instead","user":{"login":"racko","id":1660674,"avatar_url":"https://avatars.githubusercontent.com/u/1660674?v=3","gravatar_id":"","url":"https://api.github.com/users/racko","html_url":"https://github.com/racko","followers_url":"https://api.github.com/users/racko/followers","following_url":"https://api.github.com/users/racko/following{/other_user}","gists_url":"https://api.github.com/users/racko/gists{/gist_id}","starred_url":"https://api.github.com/users/racko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/racko/subscriptions","organizations_url":"https://api.github.com/users/racko/orgs","repos_url":"https://api.github.com/users/racko/repos","events_url":"https://api.github.com/users/racko/events{/privacy}","received_events_url":"https://api.github.com/users/racko/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-02-25T12:52:38Z","updated_at":"2017-02-27T21:38:34Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ros/ros_comm/pulls/1000","html_url":"https://github.com/ros/ros_comm/pull/1000","diff_url":"https://github.com/ros/ros_comm/pull/1000.diff","patch_url":"https://github.com/ros/ros_comm/pull/1000.patch"},"body":"See issue #999 \r\n\r\nI tested the swap function using the following script and inspecting the resulting bag files using `rostopic echo -b`.\r\n\r\n```\r\n#include <rosbag/bag.h>\r\n#include <std_msgs/String.h>\r\n\r\nvoid test1(rosbag::CompressionType a, rosbag::CompressionType b) {\r\n    rosbag::Bag bag1(\"/tmp/out11\" + std::to_string(a) + std::to_string(b) + \".bag\", rosbag::bagmode::Write);\r\n    rosbag::Bag bag2(\"/tmp/out12\" + std::to_string(a) + std::to_string(b) + \".bag\", rosbag::bagmode::Write);\r\n    bag1.setCompression(a);\r\n    bag2.setCompression(b);\r\n    swap(bag1, bag2);\r\n    bag1.write(\"/data\", ros::Time(0, 1), std_msgs::String());\r\n    bag2.write(\"/data\", ros::Time(0, 1), std_msgs::String());\r\n}\r\n\r\nvoid test2(rosbag::CompressionType a, rosbag::CompressionType b) {\r\n    rosbag::Bag bag1(\"/tmp/out21\" + std::to_string(a) + std::to_string(b) + \".bag\", rosbag::bagmode::Write);\r\n    rosbag::Bag bag2(\"/tmp/out22\" + std::to_string(a) + std::to_string(b) + \".bag\", rosbag::bagmode::Write);\r\n    swap(bag1, bag2);\r\n    bag1.setCompression(a);\r\n    bag2.setCompression(b);\r\n    bag1.write(\"/data\", ros::Time(0, 1), std_msgs::String());\r\n    bag2.write(\"/data\", ros::Time(0, 1), std_msgs::String());\r\n}\r\n\r\nint main() {\r\n    for (auto i = 0; i < 3; ++i) {\r\n        for (auto j = 0; j < 3; ++j) {\r\n            test1(rosbag::CompressionType(i), rosbag::CompressionType(j));\r\n            test2(rosbag::CompressionType(i), rosbag::CompressionType(j));\r\n        }   \r\n    }   \r\n    return 0;\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/ros/ros_comm/issues/comments/282862489","html_url":"https://github.com/ros/ros_comm/pull/1000#issuecomment-282862489","issue_url":"https://api.github.com/repos/ros/ros_comm/issues/1000","id":282862489,"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},"created_at":"2017-02-27T21:38:34Z","updated_at":"2017-02-27T21:38:34Z","body":"Can you please add tests for this new API."}}
{"actor":{"display_login":"dirk-thomas"}}