![]() |
The Gaudi Framework
master (e68eea06)
|
Handle to be used in lieu of naked pointers to gaudis. More...
#include <GaudiKernel/GaudiHandle.h>


Public Member Functions | |
| 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 | |
| GaudiHandle (std::string myTypeAndName, std::string myComponentType, std::string myParentName) | |
| virtual StatusCode | retrieve (T *&) const =0 |
| Retrieve the component. | |
| virtual StatusCode | release (T *comp) const |
| Release the component. | |
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 | |
| void | assertObject () const |
| Load the pointer to the component. | |
Private Attributes | |
| std::atomic< T * > | m_pObject = nullptr |
Additional Inherited Members | |
Public Types inherited from GaudiHandleBase | |
| using | PropertyType = GaudiHandleProperty |
Handle to be used in lieu of naked pointers to gaudis.
This allows better control through the framework of gaudi loading and usage. T is the type of the component interface (or concrete class).
Definition at line 176 of file GaudiHandle.h.
|
inlineprotected |
Definition at line 181 of file GaudiHandle.h.
|
inline |
Copy constructor needed for correct ref-counting.
Definition at line 187 of file GaudiHandle.h.
|
inline |
Copy constructor needed for correct ref-counting.
Definition at line 194 of file GaudiHandle.h.
|
inlineprivate |
Load the pointer to the component.
Do a retrieve if needed. Throw an exception if retrieval fails.
Definition at line 314 of file GaudiHandle.h.
|
inline |
Return the wrapped pointer, not calling retrieve() if null.
Definition at line 261 of file GaudiHandle.h.
|
inline |
Return the wrapped pointer, not calling retrieve() if null.
Definition at line 264 of file GaudiHandle.h.
|
inline |
Definition at line 294 of file GaudiHandle.h.
|
inline |
Helper function to get default type string from the class type.
Definition at line 292 of file GaudiHandle.h.
|
inline |
|
inline |
Check if the handle is valid (try to retrive the object is not done yet).
Definition at line 248 of file GaudiHandle.h.
|
inline |
For testing if handle has component.
Does retrieve() if needed. If this returns false, the component could not be retrieved.
Definition at line 255 of file GaudiHandle.h.
|
inline |
Definition at line 269 of file GaudiHandle.h.
|
inline |
Definition at line 279 of file GaudiHandle.h.
|
inline |
Definition at line 274 of file GaudiHandle.h.
|
inline |
Definition at line 285 of file GaudiHandle.h.
|
inline |
Assignment operator for correct ref-counting.
Definition at line 212 of file GaudiHandle.h.
|
inline |
Assignment operator for correct ref-counting.
Definition at line 201 of file GaudiHandle.h.
|
inline |
Release the component.
Definition at line 237 of file GaudiHandle.h.
|
inlineprotectedvirtual |
Release the component.
Default implementation calls release() on the component. Can be overridden by the derived class if something else is needed.
Reimplemented in ToolHandle< T >, ToolHandle< const IMyTool >, ToolHandle< Gaudi::Tests::Histograms::Directories::HistoGroupsTool >, ToolHandle< Gaudi::TestSuite::FloatTool >, ToolHandle< GaudiTesting::ITestTool >, ToolHandle< IAlgTool >, ToolHandle< IMyTool >, ToolHandle< IThreadInitTool >, and ToolHandle< IWrongTool >.
Definition at line 305 of file GaudiHandle.h.
|
inline |
Retrieve the component.
Release existing component if needed.
Definition at line 223 of file GaudiHandle.h.
|
protectedpure virtual |
Retrieve the component.
To be implemented by the derived class. It will pass the pointer
Implemented in ServiceHandle< T >, ServiceHandle< Gaudi::Example::TinyExperiment::IRandomGenSvc >, ServiceHandle< Gaudi::Interfaces::IFileSvc >, ServiceHandle< Gaudi::TestSuite::SvcWithoutInterface >, ServiceHandle< IAlgContextSvc >, ServiceHandle< IFileMgr >, ServiceHandle< IIncidentSvc >, ServiceHandle< IInterface >, ServiceHandle< INTupleSvc >, ServiceHandle< IPartPropSvc >, ServiceHandle< ITHistSvc >, ServiceHandle< IToolSvc >, ToolHandle< T >, ToolHandle< const IMyTool >, ToolHandle< Gaudi::Tests::Histograms::Directories::HistoGroupsTool >, ToolHandle< Gaudi::TestSuite::FloatTool >, ToolHandle< GaudiTesting::ITestTool >, ToolHandle< IAlgTool >, ToolHandle< IMyTool >, ToolHandle< IThreadInitTool >, and ToolHandle< IWrongTool >.
|
mutableprivate |
Definition at line 325 of file GaudiHandle.h.