{"action":"created","comment":{"url":"https://api.github.com/repos/simbody/simbody/pulls/comments/66018129","id":66018129,"diff_hunk":"@@ -1708,10 +1709,77 @@ template <class T> inline\n auto fromXmlElementHelper(T& thing, Xml::Element& elt, \n                           const std::string& requiredTag, int) \n     -> void {\n+    // TODO std::cout << \"DEBUGfromXmlfree\" << elt << std::endl;\n     fromXmlElement(thing, elt, requiredTag); // call free function\n }\n \n \n+inline void fromXmlElementHelperHelperRecurse(Xml::element_iterator eit,\n+        Xml::element_iterator end) {\n+    assert(eit == end);\n+}\n+\n+/*\n+// TODO decide between this and the other interface. ","path":"SimTKcommon/include/SimTKcommon/internal/Xml.h","position":null,"original_position":23,"commit_id":"cd1efab855398a023f34f05f0441fb6bc8388c5d","original_commit_id":"fbf8c7bda21d9a47cdf5d7852bdf9631aa9608d2","user":{"login":"chrisdembia","id":846001,"avatar_url":"https://avatars.githubusercontent.com/u/846001?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisdembia","html_url":"https://github.com/chrisdembia","followers_url":"https://api.github.com/users/chrisdembia/followers","following_url":"https://api.github.com/users/chrisdembia/following{/other_user}","gists_url":"https://api.github.com/users/chrisdembia/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisdembia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisdembia/subscriptions","organizations_url":"https://api.github.com/users/chrisdembia/orgs","repos_url":"https://api.github.com/users/chrisdembia/repos","events_url":"https://api.github.com/users/chrisdembia/events{/privacy}","received_events_url":"https://api.github.com/users/chrisdembia/received_events","type":"User","site_admin":false},"body":"Yes; done.","created_at":"2016-06-07T06:50:34Z","updated_at":"2016-06-07T06:50:34Z","html_url":"https://github.com/simbody/simbody/pull/504#discussion_r66018129","pull_request_url":"https://api.github.com/repos/simbody/simbody/pulls/504","_links":{"self":{"href":"https://api.github.com/repos/simbody/simbody/pulls/comments/66018129"},"html":{"href":"https://github.com/simbody/simbody/pull/504#discussion_r66018129"},"pull_request":{"href":"https://api.github.com/repos/simbody/simbody/pulls/504"}}},"pull_request":{"url":"https://api.github.com/repos/simbody/simbody/pulls/504","id":72646390,"html_url":"https://github.com/simbody/simbody/pull/504","diff_url":"https://github.com/simbody/simbody/pull/504.diff","patch_url":"https://github.com/simbody/simbody/pull/504.patch","issue_url":"https://api.github.com/repos/simbody/simbody/issues/504","number":504,"state":"open","locked":false,"title":"Add a helper for fromXmlElement implementations; Add serialization for Rotation","user":{"login":"chrisdembia","id":846001,"avatar_url":"https://avatars.githubusercontent.com/u/846001?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisdembia","html_url":"https://github.com/chrisdembia","followers_url":"https://api.github.com/users/chrisdembia/followers","following_url":"https://api.github.com/users/chrisdembia/following{/other_user}","gists_url":"https://api.github.com/users/chrisdembia/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisdembia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisdembia/subscriptions","organizations_url":"https://api.github.com/users/chrisdembia/orgs","repos_url":"https://api.github.com/users/chrisdembia/repos","events_url":"https://api.github.com/users/chrisdembia/events{/privacy}","received_events_url":"https://api.github.com/users/chrisdembia/received_events","type":"User","site_admin":false},"body":"This PR contains a new helper function that can be used when implementing `fromXmlElement()`. Right now, it's named `fromXmlElementHelperHelper()`; a better name would be `fromXmlElementHelper()` but that's taken for now. This is a variadic template function that takes references to the variables you want to set. It also handles `AbstractValue`s in a uniform way (if the `AbstractValue` is contained in a smart pointer). I don't expect *all* implementations of `fromXmlElement()` to use `fromXmlElementHelperHelper()`, but I think it can be useful in many cases and reduces the chance of making an error. In particular, this helper does not really help with managing backwards compatibility for multiple versions; I expect the implementor would have to detect the version and then make appropriate calls to the helperhelper.\r\n\r\nThis PR also adds xml (de)serialization methods for Rotation. \r\n\r\n@sherm1, even if you like these changes, I expect some cleanup will be necessary. I would like to do such cleanup in follow-up PRs to the feature branch. If you like the helperhelper, I will also create one for `toXmlElement()`.\r\n\r\nSome questions:\r\n\r\n1. What's the best way to handle the template type to `Rotation_`? Right now, I ignore it. Is that okay? Should we use another Xml attribute (`P=\"Real\"`)?\r\n2. Right now, `Rotation_::fromXmlElement()` does *not* try to make the provided Mat33 a valid rotation matrix. I think this is the right thing to do, but your opinion would be helpful. I think it's important to get the *exact* same results with the deserialized State, and this requires using all values exactly as they were, without doing any corrections. I tried using `Rotation(mat)` originally to deserialize, and this led to the last 2 or 3 digits being different from the original values. ","created_at":"2016-06-06T01:07:42Z","updated_at":"2016-06-07T06:50:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5e97ab1683f6432c1a957fea35a93feb1752316d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/simbody/simbody/pulls/504/commits","review_comments_url":"https://api.github.com/repos/simbody/simbody/pulls/504/comments","review_comment_url":"https://api.github.com/repos/simbody/simbody/pulls/comments{/number}","comments_url":"https://api.github.com/repos/simbody/simbody/issues/504/comments","statuses_url":"https://api.github.com/repos/simbody/simbody/statuses/cd1efab855398a023f34f05f0441fb6bc8388c5d","head":{"label":"chrisdembia:Rotation_xml_serialization_and_recursive_helper","ref":"Rotation_xml_serialization_and_recursive_helper","sha":"cd1efab855398a023f34f05f0441fb6bc8388c5d","user":{"login":"chrisdembia","id":846001,"avatar_url":"https://avatars.githubusercontent.com/u/846001?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisdembia","html_url":"https://github.com/chrisdembia","followers_url":"https://api.github.com/users/chrisdembia/followers","following_url":"https://api.github.com/users/chrisdembia/following{/other_user}","gists_url":"https://api.github.com/users/chrisdembia/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisdembia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisdembia/subscriptions","organizations_url":"https://api.github.com/users/chrisdembia/orgs","repos_url":"https://api.github.com/users/chrisdembia/repos","events_url":"https://api.github.com/users/chrisdembia/events{/privacy}","received_events_url":"https://api.github.com/users/chrisdembia/received_events","type":"User","site_admin":false},"repo":{"id":12479956,"name":"simbody","full_name":"chrisdembia/simbody","owner":{"login":"chrisdembia","id":846001,"avatar_url":"https://avatars.githubusercontent.com/u/846001?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisdembia","html_url":"https://github.com/chrisdembia","followers_url":"https://api.github.com/users/chrisdembia/followers","following_url":"https://api.github.com/users/chrisdembia/following{/other_user}","gists_url":"https://api.github.com/users/chrisdembia/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisdembia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisdembia/subscriptions","organizations_url":"https://api.github.com/users/chrisdembia/orgs","repos_url":"https://api.github.com/users/chrisdembia/repos","events_url":"https://api.github.com/users/chrisdembia/events{/privacy}","received_events_url":"https://api.github.com/users/chrisdembia/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chrisdembia/simbody","description":"Source code for the Simbody libraries, examples, and build system.","fork":true,"url":"https://api.github.com/repos/chrisdembia/simbody","forks_url":"https://api.github.com/repos/chrisdembia/simbody/forks","keys_url":"https://api.github.com/repos/chrisdembia/simbody/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chrisdembia/simbody/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chrisdembia/simbody/teams","hooks_url":"https://api.github.com/repos/chrisdembia/simbody/hooks","issue_events_url":"https://api.github.com/repos/chrisdembia/simbody/issues/events{/number}","events_url":"https://api.github.com/repos/chrisdembia/simbody/events","assignees_url":"https://api.github.com/repos/chrisdembia/simbody/assignees{/user}","branches_url":"https://api.github.com/repos/chrisdembia/simbody/branches{/branch}","tags_url":"https://api.github.com/repos/chrisdembia/simbody/tags","blobs_url":"https://api.github.com/repos/chrisdembia/simbody/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chrisdembia/simbody/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chrisdembia/simbody/git/refs{/sha}","trees_url":"https://api.github.com/repos/chrisdembia/simbody/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chrisdembia/simbody/statuses/{sha}","languages_url":"https://api.github.com/repos/chrisdembia/simbody/languages","stargazers_url":"https://api.github.com/repos/chrisdembia/simbody/stargazers","contributors_url":"https://api.github.com/repos/chrisdembia/simbody/contributors","subscribers_url":"https://api.github.com/repos/chrisdembia/simbody/subscribers","subscription_url":"https://api.github.com/repos/chrisdembia/simbody/subscription","commits_url":"https://api.github.com/repos/chrisdembia/simbody/commits{/sha}","git_commits_url":"https://api.github.com/repos/chrisdembia/simbody/git/commits{/sha}","comments_url":"https://api.github.com/repos/chrisdembia/simbody/comments{/number}","issue_comment_url":"https://api.github.com/repos/chrisdembia/simbody/issues/comments{/number}","contents_url":"https://api.github.com/repos/chrisdembia/simbody/contents/{+path}","compare_url":"https://api.github.com/repos/chrisdembia/simbody/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chrisdembia/simbody/merges","archive_url":"https://api.github.com/repos/chrisdembia/simbody/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chrisdembia/simbody/downloads","issues_url":"https://api.github.com/repos/chrisdembia/simbody/issues{/number}","pulls_url":"https://api.github.com/repos/chrisdembia/simbody/pulls{/number}","milestones_url":"https://api.github.com/repos/chrisdembia/simbody/milestones{/number}","notifications_url":"https://api.github.com/repos/chrisdembia/simbody/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chrisdembia/simbody/labels{/name}","releases_url":"https://api.github.com/repos/chrisdembia/simbody/releases{/id}","deployments_url":"https://api.github.com/repos/chrisdembia/simbody/deployments","created_at":"2013-08-30T06:46:15Z","updated_at":"2015-04-01T23:06:40Z","pushed_at":"2016-06-07T06:49:57Z","git_url":"git://github.com/chrisdembia/simbody.git","ssh_url":"git@github.com:chrisdembia/simbody.git","clone_url":"https://github.com/chrisdembia/simbody.git","svn_url":"https://github.com/chrisdembia/simbody","homepage":"https://simtk.org/home/simbody","size":205360,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"simbody:feature_state_serialization","ref":"feature_state_serialization","sha":"c41b7857168ba84640c4a46d918293b8e95bb203","user":{"login":"simbody","id":5199961,"avatar_url":"https://avatars.githubusercontent.com/u/5199961?v=3","gravatar_id":"","url":"https://api.github.com/users/simbody","html_url":"https://github.com/simbody","followers_url":"https://api.github.com/users/simbody/followers","following_url":"https://api.github.com/users/simbody/following{/other_user}","gists_url":"https://api.github.com/users/simbody/gists{/gist_id}","starred_url":"https://api.github.com/users/simbody/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simbody/subscriptions","organizations_url":"https://api.github.com/users/simbody/orgs","repos_url":"https://api.github.com/users/simbody/repos","events_url":"https://api.github.com/users/simbody/events{/privacy}","received_events_url":"https://api.github.com/users/simbody/received_events","type":"Organization","site_admin":false},"repo":{"id":12146969,"name":"simbody","full_name":"simbody/simbody","owner":{"login":"simbody","id":5199961,"avatar_url":"https://avatars.githubusercontent.com/u/5199961?v=3","gravatar_id":"","url":"https://api.github.com/users/simbody","html_url":"https://github.com/simbody","followers_url":"https://api.github.com/users/simbody/followers","following_url":"https://api.github.com/users/simbody/following{/other_user}","gists_url":"https://api.github.com/users/simbody/gists{/gist_id}","starred_url":"https://api.github.com/users/simbody/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simbody/subscriptions","organizations_url":"https://api.github.com/users/simbody/orgs","repos_url":"https://api.github.com/users/simbody/repos","events_url":"https://api.github.com/users/simbody/events{/privacy}","received_events_url":"https://api.github.com/users/simbody/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/simbody/simbody","description":"High-performance C++ multibody dynamics/physics library for simulating articulated biomechanical and mechanical systems like vehicles, robots, and the human skeleton.","fork":false,"url":"https://api.github.com/repos/simbody/simbody","forks_url":"https://api.github.com/repos/simbody/simbody/forks","keys_url":"https://api.github.com/repos/simbody/simbody/keys{/key_id}","collaborators_url":"https://api.github.com/repos/simbody/simbody/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/simbody/simbody/teams","hooks_url":"https://api.github.com/repos/simbody/simbody/hooks","issue_events_url":"https://api.github.com/repos/simbody/simbody/issues/events{/number}","events_url":"https://api.github.com/repos/simbody/simbody/events","assignees_url":"https://api.github.com/repos/simbody/simbody/assignees{/user}","branches_url":"https://api.github.com/repos/simbody/simbody/branches{/branch}","tags_url":"https://api.github.com/repos/simbody/simbody/tags","blobs_url":"https://api.github.com/repos/simbody/simbody/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/simbody/simbody/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/simbody/simbody/git/refs{/sha}","trees_url":"https://api.github.com/repos/simbody/simbody/git/trees{/sha}","statuses_url":"https://api.github.com/repos/simbody/simbody/statuses/{sha}","languages_url":"https://api.github.com/repos/simbody/simbody/languages","stargazers_url":"https://api.github.com/repos/simbody/simbody/stargazers","contributors_url":"https://api.github.com/repos/simbody/simbody/contributors","subscribers_url":"https://api.github.com/repos/simbody/simbody/subscribers","subscription_url":"https://api.github.com/repos/simbody/simbody/subscription","commits_url":"https://api.github.com/repos/simbody/simbody/commits{/sha}","git_commits_url":"https://api.github.com/repos/simbody/simbody/git/commits{/sha}","comments_url":"https://api.github.com/repos/simbody/simbody/comments{/number}","issue_comment_url":"https://api.github.com/repos/simbody/simbody/issues/comments{/number}","contents_url":"https://api.github.com/repos/simbody/simbody/contents/{+path}","compare_url":"https://api.github.com/repos/simbody/simbody/compare/{base}...{head}","merges_url":"https://api.github.com/repos/simbody/simbody/merges","archive_url":"https://api.github.com/repos/simbody/simbody/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/simbody/simbody/downloads","issues_url":"https://api.github.com/repos/simbody/simbody/issues{/number}","pulls_url":"https://api.github.com/repos/simbody/simbody/pulls{/number}","milestones_url":"https://api.github.com/repos/simbody/simbody/milestones{/number}","notifications_url":"https://api.github.com/repos/simbody/simbody/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/simbody/simbody/labels{/name}","releases_url":"https://api.github.com/repos/simbody/simbody/releases{/id}","deployments_url":"https://api.github.com/repos/simbody/simbody/deployments","created_at":"2013-08-16T00:21:53Z","updated_at":"2016-06-05T20:38:02Z","pushed_at":"2016-06-07T06:49:58Z","git_url":"git://github.com/simbody/simbody.git","ssh_url":"git@github.com:simbody/simbody.git","clone_url":"https://github.com/simbody/simbody.git","svn_url":"https://github.com/simbody/simbody","homepage":"https://simtk.org/home/simbody","size":202163,"stargazers_count":566,"watchers_count":566,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":188,"mirror_url":null,"open_issues_count":86,"forks":188,"open_issues":86,"watchers":566,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/simbody/simbody/pulls/504"},"html":{"href":"https://github.com/simbody/simbody/pull/504"},"issue":{"href":"https://api.github.com/repos/simbody/simbody/issues/504"},"comments":{"href":"https://api.github.com/repos/simbody/simbody/issues/504/comments"},"review_comments":{"href":"https://api.github.com/repos/simbody/simbody/pulls/504/comments"},"review_comment":{"href":"https://api.github.com/repos/simbody/simbody/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/simbody/simbody/pulls/504/commits"},"statuses":{"href":"https://api.github.com/repos/simbody/simbody/statuses/cd1efab855398a023f34f05f0441fb6bc8388c5d"}}}}
{"actor":{"display_login":"chrisdembia"}}