osrf / gazebo_experimental

Repo for Gazebo 9 development. Starting from entity_component_system_prototype branch on gazebo repo. This repo will be merged back into the gazebo repo in the future.
0 stars 1 forks source link

Components should use PIMPL pattern to avoid ABI breakage during updates #25

Open osrf-migration opened 7 years ago

osrf-migration commented 7 years ago

Original report (archived issue) by Shane Loretz (Bitbucket: Shane Loretz, GitHub: sloretz).


Currently components are structs/unions that expose their member variables directly. This is great for speed of reading/writing from them, but means any changes to a component will break ABI. Components should use the PIMPL pattern or something similar so that maintenance isn't a difficult issue in the future.

osrf-migration commented 7 years ago

Original comment by Shane Loretz (Bitbucket: Shane Loretz, GitHub: sloretz).


Related to #17, #18, and #19: I looked at seeing if c++ code generated by protobuf would maintian ABI compatibility if fields are added, they're not. Fields are added to the classes as private member variables, so adding one will change the size of the class. This rules out using a generated protobuf class as the API used by systems for reading/writing components.

If the data was serialized and then passed to the systems adding fields is ABI compatible. Systems would have their own compiled version of the generated protobuf class which has support for forwards/backwards compatibility within some limits. A downside is it adds the overhead of serializing/deserializing instead of just reading from the component.

osrf-migration commented 7 years ago

Original comment by Shane Loretz (Bitbucket: Shane Loretz, GitHub: sloretz).


Will be solved once pull request #37 and pull request #36 are merged.