Open m-rest opened 7 years ago
One class = One header (hpp) in order to produce "header-only" api. As i've say in my email, a more clean and easy-to-use api where the classes are template-oriented and where the structure is based on modularity is the "header-only" api.
Take a look at the powerfull KFR library for a global idea of api organisation : https://www.kfrlib.com/
1) a "include" directory a the root of the core engine directory : rt-wdf_lib 2) a "wdf" directory subfolder that become the root directory of the core engine for the end-user. 3) all the others subfolders respects the namespacing scheme. 4) one header (.hpp) by class, same name as the class in lowercase. (underscore allowed if needed)
The end user link the include directory as : [root_of_rt_wdf]/rt-wdf_lin/include
and include a single includer file : #include <wdf/wdf.hpp>
The include directory can be something like (in progress) :
.... include /
........ wdf /
............ root /
................ rtype.hpp
................ ...
............ matrix.hpp
............ root.hpp
............ tree.hpp
............ ...
............ wdf.hpp
The Pimpl (private implementation) idiom is not really valid in a "header-only" context. Another way to do similar things is to use some "internal" namespacing where internal code is hidden (not really protected as pimpl) for the end-user.
As I have say before, a look to the KFR library is welcome to see what I mean.
One class = One header (h) + One source (cpp) seem a better idea in a case of a framework for the end-user.
A Pimpl idiom is not a bad idea for the main classes like the Tree class where a part of the method are for internal engine processing, not for the end-user.