sdformat icon indicating copy to clipboard operation
sdformat copied to clipboard

Modifying the `ElementPrivate` should not break ABI

Open azeey opened this issue 4 years ago • 1 comments

Desired behavior

The sdf::Element class uses the Pimpl pattern with sdf::ElementPrivate so as to not break ABI when adding new data members. This however doesn't work as expected as we recently found (see #605, #606). We should find a way to make changes to sdf::ElementPrivate without breaking ABI.

Implementation suggestion

  • Move sdf::ElementPrivate to Element.cc
  • Add getter functions for members needed by template functions.

azeey avatar Jun 28 '21 22:06 azeey

In order to get around the template method issue, it might be worth looking at the EntityComponentManager class in ign-gazebo, where there's a private *Implementation method that uses the forward-declared pImpl in the method definition (example).

adlarkin avatar Jun 28 '21 23:06 adlarkin