{"action":"closed","issue":{"url":"https://api.github.com/repos/ros-industrial-consortium/descartes/issues/103","labels_url":"https://api.github.com/repos/ros-industrial-consortium/descartes/issues/103/labels{/name}","comments_url":"https://api.github.com/repos/ros-industrial-consortium/descartes/issues/103/comments","events_url":"https://api.github.com/repos/ros-industrial-consortium/descartes/issues/103/events","html_url":"https://github.com/ros-industrial-consortium/descartes/issues/103","id":66718945,"number":103,"title":"TrajectoryPt cloneTo() method unimplemented","user":{"login":"Jmeyer1292","id":4960180,"avatar_url":"https://avatars.githubusercontent.com/u/4960180?v=3","gravatar_id":"","url":"https://api.github.com/users/Jmeyer1292","html_url":"https://github.com/Jmeyer1292","followers_url":"https://api.github.com/users/Jmeyer1292/followers","following_url":"https://api.github.com/users/Jmeyer1292/following{/other_user}","gists_url":"https://api.github.com/users/Jmeyer1292/gists{/gist_id}","starred_url":"https://api.github.com/users/Jmeyer1292/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Jmeyer1292/subscriptions","organizations_url":"https://api.github.com/users/Jmeyer1292/orgs","repos_url":"https://api.github.com/users/Jmeyer1292/repos","events_url":"https://api.github.com/users/Jmeyer1292/events{/privacy}","received_events_url":"https://api.github.com/users/Jmeyer1292/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-04-06T22:20:51Z","updated_at":"2015-04-09T06:23:02Z","closed_at":"2015-04-09T06:23:02Z","body":"The base class for TrajectoryPt defines a virtual method cloneTo:\r\n\r\n```c++\r\nvirtual void cloneTo(TrajectoryPt &clone) const\r\n  {\r\n    clone = *this;\r\n    clone.setID(TrajectoryID::make_id());\r\n  }\r\n```\r\n\r\nThis method is unimplemented in all of the child classes and it will not do the 'expected' thing. What I believe it will do is 'slice' the 'this' variable and only copy the information that it is aware of in the base class itself. \r\n\r\nThe fix is probably to create a clone function that returns an entirely new TrajectoryPtPtr with the appropriate underlying type. The implementation will probably look something like:\r\n```c++\r\nvirtual TrajectoyPtPtr clone() const\r\n{\r\n// add cloning info for timing and ids\r\nreturn new SomeTypeOfPt(*this);\r\n}\r\n```\r\n\r\nOr it could by a cloneTo method. The difficulty there is memory management. You'd probably have to take a shared pointer by reference and call it's reset function."}}