Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ToolSelect isn't aware of namespaces #1

Open
tdealtry opened this issue Aug 9, 2023 · 0 comments
Open

ToolSelect isn't aware of namespaces #1

tdealtry opened this issue Aug 9, 2023 · 0 comments

Comments

@tdealtry
Copy link

tdealtry commented Aug 9, 2023

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

  1. adding the line
using namespace HK::GHOST::G4;
  1. modifying the line to add the namespaces explictly
if (tool=="WCSim_exe") ret=new HK::GHOST::WCSim_exe;
  1. 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 🤞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant