Skip to content

ToolSelect isn't aware of namespaces #1

Description

@tdealtry

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 🤞

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions