Open osrf-migration opened 6 years ago
Original comment by Michael Grey (Bitbucket: mxgrey, GitHub: mxgrey).
I wanted to make a suggestion, because I think it could allow a much cleaner diff and save a lot of work. We could define some macros:
#ifdef __MSC_VER
#define INTERNAL_GAZEBO_IGNORE_DLL_EXPORT \
__pragma(warning(push)) \
__pragma(warning(disable: 4251))
#define INTERNAL_GAZEBO_RESUME_DLL_EXPORT \
__pragma(warning(pop))
#else
#define INTERNAL_GAZEBO_IGNORE_DLL_EXPORT
#define INTERNAL_GAZEBO_RESUME_DLL_EXPORT
#endif
#define INTERNAL_GAZEBO_DATAPTR \
class Implementation; \
INTERNAL_GAZEBO_IGNORE_DLL_EXPORT \
std::unique_ptr<Implementation> dataPtr; \
INTERNAL_GAZEBO_RESUME_DLL_EXPORT
Then we can just put a single INTERNAL_GAZEBO_DATAPTR
in each class that violates PIMPL to forward declare the implementation class, add the dataPtr
field, and suppress the DLL interface warnings that will be emitted by Visual Studio.
To define the implementation class, in a source file we can put:
class Xxx::Implementation
{
// Data fields of implementation class go here
};
where Xxx
is the name of the class that is being PIMPLed.
(For the record, I'm writing all of this from my phone in the airport, so I apologize in advance for any mistakes.)
Original comment by Michael Grey (Bitbucket: mxgrey, GitHub: mxgrey).
Side note: we'll probably also have to add explicit destructors for each class that we PIMPLize, so those destructors would have to be added alongside the macro for any classes that don't already have one. We would need to do that with or without the macro approach that I proposed.
Original report (archived issue) by Shane Loretz (Bitbucket: Shane Loretz, GitHub: sloretz).
Follow up to today's meeting, these headers do not contain the text "dataPtr". This ticket is to add a private member
std::unique_ptr<*Private> dataPtr;
and forward declaration for all of them so that it is easier to fix bugs between major releases.First I created a list with the command
Then I manually checked and removed some files whose names suggested they wouldn't contain a class (like "Types.hh", or "Iface.hh"). I have not checked every file here.
Rendering
Common
Physics
Transport
Sensors
GUI