16typedef std::map< std::string, asg::IAsgTool* >
ToolMap_t;
22 std::mutex s_toolMutex;
29 using namespace msgToolStore;
33 ANA_MSG_ERROR(
"asg::ToolStore::put: Received a null pointer" );
34 return StatusCode::FAILURE;
38 const std::string& name = ptool->name();
40 ANA_MSG_ERROR(
"asg::ToolStore::put: The received tool doesn't have a name" );
41 return StatusCode::FAILURE;
44 std::lock_guard<std::mutex> lock (s_toolMutex);
46 if( s_tools.find( name ) != s_tools.end() ) {
48 << name <<
"\" already registered");
49 return StatusCode::FAILURE;
53 s_tools[ name ] = ptool;
54 return StatusCode::SUCCESS;
58 using namespace msgToolStore;
60 std::lock_guard<std::mutex> lock (s_toolMutex);
61 ToolMap_t::const_iterator itool = s_tools.find( name );
62 if( itool != s_tools.end() )
65 if (name.compare(0, 8,
"ToolSvc.") != 0) {
66 itool = s_tools.find(
"ToolSvc." + name );
67 if( itool != s_tools.end() )
80 return remove( tool->name() );
85 std::lock_guard<std::mutex> lock (s_toolMutex);
87 s_tools.erase( name );
88 return StatusCode::SUCCESS;
93 void ToolStore::dumpToolConfig () {
94 using namespace asg::msgProperty;
98 std::map<std::string,std::map<std::string,std::string> > properties;
100 std::lock_guard<std::mutex> lock (s_toolMutex);
101 for (
auto& tool : s_tools)
103 auto& myproperties = properties[tool.first];
104 myproperties[
""] = std::string (
typeid(*tool.second).name()) +
"/" + tool.first;
106 if (mytool ==
nullptr)
108 ANA_MSG_ERROR (
"tool " << tool.first <<
" not of AsgTool type");
109 myproperties[
""] +=
" <invalid type>";
112 for (
auto& property : mytool->getPropertyMgr()->getProperties())
114 std::string asString;
115 if (property.second->getString (asString).isFailure())
117 ANA_MSG_ERROR (
"on property " << property.first <<
" for tool " << tool.first);
118 myproperties[
property.first] =
"<<invalid>>";
120 myproperties[
property.first] = asString;
124 for (
const auto& myproperties : properties)
126 for (
auto& property : myproperties.second)
128 std::cout << myproperties.first;
129 if (!property.first.empty())
130 std::cout <<
"." <<
property.first;
131 std::cout <<
" = " <<
property.second <<
"\n";
134 std::cout << std::flush;
#define ATLAS_THREAD_SAFE