sdformat
sdformat copied to clipboard
Modifying the `ElementPrivate` should not break ABI
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::ElementPrivatetoElement.cc - Add getter functions for members needed by template functions.
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).