Say I have a tool inside namespaces HK::GHOST::WCSim_exe
After calling ToolSelect.sh and adding just that tool, Factory.cpp looks like this
#include "Factory.h"
Tool* Factory(std::string tool) {
Tool* ret=0;
// if (tool=="Type") tool=new Type;
if (tool=="WCSim_exe") ret=new WCSim_exe;
return ret;
}
and we get errors upon make like
UserTools/Factory/Factory.cpp:8:32: error: ‘WCSim_exe’ does not name a type; did you mean ‘WCSim_exe_H’?
if (tool=="WCSim_exe") ret=new WCSim_exe;
There's a couple of possible workarounds
- adding the line
using namespace HK::GHOST::G4;
- modifying the line to add the namespaces explictly
if (tool=="WCSim_exe") ret=new HK::GHOST::WCSim_exe;
- seems better to me, as it allows different namespaces to use the same tool name without clashing. The whole point of namespaces. Thoughts?
The other thing is that we need some clever & bulletproof way of extracting the Tool class namespace. I've not done much digging for such a tool, as someone may already have a solution 🤞
Say I have a tool inside namespaces
HK::GHOST::WCSim_exeAfter calling
ToolSelect.shand adding just that tool,Factory.cpplooks like thisand we get errors upon
makelikeThere's a couple of possible workarounds
The other thing is that we need some clever & bulletproof way of extracting the Tool class namespace. I've not done much digging for such a tool, as someone may already have a solution 🤞