ATLAS Offline Software
ToolStore.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ASGTOOLS_TOOLSTORE_H
6 #define ASGTOOLS_TOOLSTORE_H
7 
8 // System include(s):
9 #include <string>
10 
11 // Local include(s):
12 #include "AsgTools/IAsgTool.h"
14 
15 namespace asg {
16 
32  class ToolStore {
33 
34  public:
37  static StatusCode put( IAsgTool* ptool );
38 
40  static IAsgTool* get( const std::string& name, bool silent = false );
41 
43  template< typename T >
44  // cppcheck-suppress constStatement; false positive
45  static T* get( const std::string& name ) {
46 
47  return dynamic_cast< T* >( get( name ) );
48  }
49 
51  template< typename T >
52  static bool contains( const std::string& name ) {
53 
54  return ( dynamic_cast< T* >( get( name, true ) ) != 0 );
55  }
56 
58  static StatusCode remove( const IAsgTool* tool );
60  static StatusCode remove( const std::string& name );
61 
62 #ifdef XAOD_STANDALONE
63  static void dumpToolConfig ();
65 #endif
66 
67  }; // class ToolStore
68 
69 } // namespace asg
70 
71 #endif // ASGTOOLS_TOOLSTORE_H
asg::IAsgTool
Base class for the dual-use tool interface classes.
Definition: IAsgTool.h:41
asg
Definition: DataHandleTestTool.h:28
asg::ToolStore
A light-weight replacement for ToolSvc for ROOT analysis.
Definition: ToolStore.h:32
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
IAsgTool.h
StatusCode.h
asg::ToolStore::contains
static bool contains(const std::string &name)
Check whether a tool with a given type and name is known in the store.
Definition: ToolStore.h:52
asg::ToolStore::put
static StatusCode put(IAsgTool *ptool)
Store a named tool by its name.
Definition: ToolStore.cxx:28
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
asg::ToolStore::get
static T * get(const std::string &name)
Retrieve a tool by name and interface.
Definition: ToolStore.h:45
asg::ToolStore::get
static IAsgTool * get(const std::string &name, bool silent=false)
Retrieve a tool by name.
Definition: ToolStore.cxx:57
asg::ToolStore::remove
static StatusCode remove(const IAsgTool *tool)
Remove the specified tool from the store.
Definition: ToolStore.cxx:77
python.trfDecorators.silent
def silent(func)
Redirect stdout/err to /dev/null Useful wrapper to get rid of ROOT verbosity...
Definition: trfDecorators.py:24