
Handle to be used in lieu of naked pointers to tools. More...
#include <GaudiKernel/ToolHandle.h>


Public Member Functions | |
| ToolHandle (const IInterface *parent=nullptr, bool createIf=true) | |
| Constructor for a tool with default tool type and name. | |
| template<typename CT = T, typename NCT = std::remove_const_t<T>> requires ( std::is_const_v<CT> && !std::is_same_v<CT, NCT> ) | |
| ToolHandle (const ToolHandle< NCT > &other) | |
| Copy constructor from a non const T to const T tool handle. | |
| ToolHandle (const std::string &toolTypeAndName, const IInterface *parent=nullptr, bool createIf=true) | |
| Create a handle ('smart pointer') to a tool. | |
| template<std::derived_from< IProperty > OWNER> | |
| ToolHandle (OWNER *owner, std::string propName, std::string toolType, std::string doc="") | |
| Autodeclaring constructor with property propName, tool type/name and documentation. | |
| template<typename... Args> | |
| ToolHandle (std::tuple< Args... > &&args) | |
| StatusCode | initialize (const std::string &toolTypeAndName, const IInterface *parent=nullptr, bool createIf=true) |
| StatusCode | retrieve () const override |
| Retrieve the AlgTool. | |
| StatusCode | retrieve (DisableTool sd) override |
| StatusCode | retrieve (EnableTool sd) override |
| StatusCode | release () const override |
| Release the AlgTool. | |
| StatusCode | retrieve (T *&algTool) const override |
| Do the real retrieval of the AlgTool. | |
| StatusCode | release (T *algTool) const override |
| Do the real release of the AlgTool. | |
| std::string | typeAndName () const override |
| std::add_const_t< T > * | get () const |
| T * | get () |
Public Member Functions inherited from BaseToolHandle | |
| StatusCode | retrieve (IAlgTool *&tool) const |
| const IAlgTool * | get () const |
| IAlgTool * | get () |
| bool | isEnabled () const |
| Helper to check if the ToolHandle should be retrieved. | |
| void | enable () |
| void | disable () |
| bool | setEnabled (bool flag) |
Public Member Functions inherited from ToolHandleInfo | |
| virtual | ~ToolHandleInfo ()=default |
| bool | isPublic () const noexcept |
| bool | createIf () const noexcept |
| const IInterface * | parent () const noexcept |
Public Member Functions inherited from GaudiHandle< T > | |
| template<typename CT = T, typename NCT = std::remove_const_t<T>> requires ( std::is_const_v<CT> && !std::is_same_v<CT, NCT> ) | |
| GaudiHandle (const GaudiHandle< NCT > &other) | |
| Copy constructor needed for correct ref-counting. | |
| GaudiHandle (const GaudiHandle &other) | |
| Copy constructor needed for correct ref-counting. | |
| template<typename CT = T, typename NCT = std::remove_const_t<T>> requires ( std::is_const_v<CT> && !std::is_same_v<CT, NCT> ) | |
| GaudiHandle & | operator= (const GaudiHandle< NCT > &other) |
| Assignment operator for correct ref-counting. | |
| GaudiHandle & | operator= (const GaudiHandle &other) |
| Assignment operator for correct ref-counting. | |
| StatusCode | retrieve () const |
| Retrieve the component. | |
| StatusCode | release () const |
| Release the component. | |
| bool | isValid () const |
| Check if the handle is valid (try to retrive the object is not done yet). | |
| operator bool () const | |
| For testing if handle has component. | |
| T * | get () |
| Return the wrapped pointer, not calling retrieve() if null. | |
| std::add_const_t< T > * | get () const |
| Return the wrapped pointer, not calling retrieve() if null. | |
| bool | isSet () const |
| True if the wrapped pointer is not null. | |
| T & | operator* () |
| T * | operator-> () |
| std::add_const_t< T > & | operator* () const |
| std::add_const_t< T > * | operator-> () const |
| std::string | getDefaultType () |
| Helper function to get default type string from the class type. | |
| std::string | getDefaultName () |
Public Member Functions inherited from GaudiHandleBase | |
| const std::string & | typeAndName () const |
| The full type and name: "type/name". | |
| std::string | type () const |
| The concrete component class name: the part before the '/'. | |
| std::string | name () const |
| The instance name: the part after the '/'. | |
| bool | empty () const |
| Check if the handle has been set to empty string (i.e. | |
| void | setTypeAndName (std::string myTypeAndName) |
| The component "type/name" string. | |
| void | setName (std::string_view myName) |
| Set the instance name (part after the '/') without changing the class type. | |
| std::string | pythonPropertyClassName () const override |
| Name of the componentType with "Handle" appended. | |
| std::string | messageName () const |
| name used for printing messages | |
| std::string | pythonRepr () const override |
| Python representation of handle, i.e. | |
Public Member Functions inherited from GaudiHandleInfo | |
| virtual | ~GaudiHandleInfo () |
| virtual destructor so that derived class destructor is called. | |
| const std::string & | componentType () const |
| const std::string & | propertyName () const |
| name as used in declareProperty(name,gaudiHandle) | |
| void | setPropertyName (std::string propName) |
| set name as used in declareProperty(name,gaudiHandle). | |
| const std::string & | parentName () const |
| The name of the parent. | |
Protected Member Functions | |
| const IAlgTool * | getAsIAlgTool () const override |
| IAlgTool * | getAsIAlgTool () override |
| StatusCode | i_retrieve (IAlgTool *&algTool) const override |
Protected Member Functions inherited from BaseToolHandle | |
| BaseToolHandle (const IInterface *parent=nullptr, bool createIf=true) | |
Protected Member Functions inherited from ToolHandleInfo | |
| ToolHandleInfo (const IInterface *parent=nullptr, bool createIf=true) | |
Protected Member Functions inherited from GaudiHandle< T > | |
| GaudiHandle (std::string myTypeAndName, std::string myComponentType, std::string myParentName) | |
Protected Member Functions inherited from GaudiHandleBase | |
| GaudiHandleBase (std::string myTypeAndName, std::string myComponentType, std::string myParentName) | |
| Create a handle ('smart pointer') to a gaudi component. | |
Protected Member Functions inherited from GaudiHandleInfo | |
| GaudiHandleInfo (std::string myComponentType, std::string myParentName) | |
| Some basic information and helper functions shared between various handles/arrays. | |
| void | setComponentType (std::string componentType) |
| The component type. | |
| void | setParentName (std::string parent) |
| The name of the parent. | |
Private Member Functions | |
| template<typename... Args, std::size_t... Is> | |
| ToolHandle (std::tuple< Args... > &&args, std::index_sequence< Is... >) | |
Private Attributes | |
| ServiceHandle< IToolSvc > | m_pToolSvc |
Friends | |
| class | Gaudi::Algorithm |
| class | AlgTool |
| class | Service |
| std::ostream & | operator<< (std::ostream &os, const ToolHandle< T > &handle) |
Additional Inherited Members | |
Public Types inherited from GaudiHandleBase | |
| using | PropertyType = GaudiHandleProperty |
Static Public Member Functions inherited from ToolHandleInfo | |
| static std::string | toolComponentType (const IInterface *parent) |
| static std::string | toolParentName (const IInterface *parent) |
Protected Attributes inherited from BaseToolHandle | |
| bool | m_enabled = true |
Protected Attributes inherited from ToolHandleInfo | |
| const IInterface * | m_parent = nullptr |
| bool | m_createIf { true } |
Handle to be used in lieu of naked pointers to tools.
This allows better control through the framework of tool loading and usage. @paramater T is the AlgTool interface class (or concrete class) of the tool to use, and must derive from IAlgTool.
Definition at line 132 of file ToolHandle.h.
|
inlineprivate |
Definition at line 139 of file ToolHandle.h.
|
inline |
Constructor for a tool with default tool type and name.
Can be called only if the type T is a concrete tool type (not an interface), and you want to use the default name.
Definition at line 146 of file ToolHandle.h.
|
inline |
Copy constructor from a non const T to const T tool handle.
Definition at line 154 of file ToolHandle.h.
|
inline |
Create a handle ('smart pointer') to a tool.
The arguments are passed on to ToolSvc, and have the same meaning:
| owner | class owning the ToolHandle |
| toolType | "MyToolType/MyToolName" "MyToolType" is short for "MyToolType/MyToolType" 'MyToolType' is the name of the class of the concrete tool 'MyToolName' is to distinguish several tool instances of the same class |
| parent | the parent Algorithm,Tool or Service of which this tool is a member. If non-zero, the the tool is a private tool of the parent, otherwise it is a public (shared) tool. |
| createIf | if true, create tool if not yet existing. |
Definition at line 190 of file ToolHandle.h.
|
inline |
Autodeclaring constructor with property propName, tool type/name and documentation.
Definition at line 199 of file ToolHandle.h.
|
inline |
Definition at line 210 of file ToolHandle.h.
|
inline |
Definition at line 277 of file ToolHandle.h.
|
inline |
Definition at line 275 of file ToolHandle.h.
|
inlineoverrideprotectedvirtual |
Implements BaseToolHandle.
Definition at line 284 of file ToolHandle.h.
|
inlineoverrideprotectedvirtual |
Implements BaseToolHandle.
Definition at line 289 of file ToolHandle.h.
|
inlineoverrideprotectedvirtual |
Implements BaseToolHandle.
Definition at line 294 of file ToolHandle.h.
|
inline |
Definition at line 213 of file ToolHandle.h.
|
inlineoverridevirtual |
Release the AlgTool.
Function must be repeated here to avoid hiding the function release( T*& )
Implements BaseToolHandle.
Definition at line 252 of file ToolHandle.h.
|
inlineoverridevirtual |
Do the real release of the AlgTool.
Reimplemented from GaudiHandle< T >.
Definition at line 271 of file ToolHandle.h.
|
inlineoverridevirtual |
Retrieve the AlgTool.
Release existing tool if needed. Function must be repeated here to avoid hiding the function retrieve( T*& )
Implements BaseToolHandle.
Definition at line 228 of file ToolHandle.h.
|
inlineoverridevirtual |
Implements BaseToolHandle.
Definition at line 232 of file ToolHandle.h.
|
inlineoverridevirtual |
Implements BaseToolHandle.
Definition at line 241 of file ToolHandle.h.
|
inlineoverridevirtual |
Do the real retrieval of the AlgTool.
Implements GaudiHandle< T >.
Definition at line 257 of file ToolHandle.h.
|
inlineoverridevirtual |
Implements BaseToolHandle.
Definition at line 273 of file ToolHandle.h.
Definition at line 135 of file ToolHandle.h.
|
friend |
Definition at line 134 of file ToolHandle.h.
|
friend |
Definition at line 279 of file ToolHandle.h.
Definition at line 136 of file ToolHandle.h.
|
mutableprivate |
Definition at line 303 of file ToolHandle.h.