I'm working on a library that contains a large number of components that have namespaces that are nested. Also, when a new module inside the library get's added, we then have to add the namespace and sometimes this namespaces can change and then it becomes hellish to maintain.
I have been thinking of a solution or approach to solving this problem and come up with this idea:
The optimal approach would be to have a .h
file containing the all of the namespaces:
namespace Config {
namespace PCA = LibraryName::Statistical::Components::PCA;
}
And then I can include this config file into the main entry to the application..
But, how I get to this point is what I am having trouble getting to. So here is my thought process:
If I create a "pre-compiled" Config.h
that contains something like (Syntax is not right, but I would parse this)
namespace Config {
"aliases" = [
"PCA" => "LibraryName::Statistical::Components::PCA"
];
}
Then, some way inside the Makefile parse this syntax, and generate a .h file, with the aliases inside it and then this would work.. But I don't know if this is possible with a Makefile?
The second approach, would be to create a shell command, on the lines of: build_config
which then parses this config file and then generate the .h
to be used in the entry to the program?
Alternatively, I can use JSON and then parse the JSON using any of the above..
Can anyone give me any guidance to which approach would be better for this, also, is this just causing unnecessary problems?
ALSO: A series of clients / Users have also asked for the ability to change the namespace aliases..