I have a header file with approximately 400 function declarations and the corresponding source definition file.
To replace the implementation with a layout at runtime, I want to replace the implementation with calls to an object that will contain the implementation instead (the pointer to the implementation is pImpl).
This means that I will have the following files:
- mainFile.h - contains method declarations, as before (should remain, since I can not replace the interface with client code)
- IImpl.h - Abstract base (interface) for the implementation object
- mainFile.cpp - Will contain method definitions, where all this it calls the corresponding method on IImpl *
- SpecificImpl.cpp - contains a declaration and definition of a specific implementation
- MockImpl.cpp - contains a declaration and definition of the implementation used during testing
The main problem is duplicating the 400-tag declarations that appear in the main header file and again in each class definition.
Is there any way to avoid this duplication? I tried with macros, but then the order of inclusions became too specific ...
source
share