| The Gaudi Framework v32r1 (f65d50dc)

Public Member Functions | List of all members
PublicToolHandle< T > Class Template Reference

Helper class to construct ToolHandle instances for public tools via the auto registering constructor. More...

`#include <GaudiKernel/ToolHandle.h>`

Inheritance diagram for PublicToolHandle< T >:
[legend]
Collaboration diagram for PublicToolHandle< T >:
[legend]

## Public Member Functions
| PublicToolHandle (bool createIf=true)
| PublicToolHandle (const char *toolTypeAndName, bool createIf=true)
| PublicToolHandle (const std::string &toolTypeAndName, bool createIf=true)
template<typename CT = T, typename NCT = std::remove_const_t<T>>
| PublicToolHandle (const PublicToolHandle< NCT > &other, std::enable_if_t< std::is_const_v< CT > &&!std::is_same_v< CT, NCT >> *=nullptr)
| Copy constructor from a non const T to const T tool handle. More...
template<class OWNER , typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
| PublicToolHandle (OWNER *owner, std::string propName, std::string toolType, std::string doc="")
| Autodeclaring constructor with property propName, tool type/name and documentation. More...
Public Member Functions inherited from ToolHandle< T >
| ToolHandle (const IInterface *parent=nullptr, bool createIf=true)
| Constructor for a tool with default tool type and name. More...
template<typename CT = T, typename NCT = std::remove_const_t<T>, typename = std::enable_if_t<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. More...
| ToolHandle (const std::string &toolTypeAndName, const IInterface *parent=nullptr, bool createIf=true)
| Create a handle ('smart pointer') to a tool. More...
template<class OWNER , typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
| ToolHandle (OWNER *owner, std::string propName, std::string toolType, std::string doc="")
| Autodeclaring constructor with property propName, tool type/name and documentation. More...
StatusCode | initialize (const std::string &toolTypeAndName, const IInterface *parent=nullptr, bool createIf=true)
StatusCode | retrieve () const override
| Retrieve the AlgTool. More...
StatusCode | retrieve (DisableTool sd) override
StatusCode | retrieve (EnableTool sd) override
StatusCode | release () const
| Release the AlgTool. More...
StatusCode | retrieve (T *&algTool) const override
| Do the real retrieval of the AlgTool. More...
StatusCode | release (T *algTool) const override
| Do the real release of the AlgTool. More...
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. More...
void | enable ()
void | disable ()
bool | setEnabled (const 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>>
| GaudiHandle (const GaudiHandle< NCT > &other, std::enable_if_t< std::is_const_v< CT > &&!std::is_same_v< CT, NCT >> *=nullptr)
| Copy constructor needed for correct ref-counting. More...
| GaudiHandle (const GaudiHandle &other)
| Copy constructor needed for correct ref-counting. More...
template<typename CT = T, typename NCT = std::remove_const_t<T>>
std::enable_if_t< std::is_const_v< CT > &&!std::is_same_v< CT, NCT >, GaudiHandle & > | operator= (const GaudiHandle< NCT > &other)
| Assignment operator for correct ref-counting. More...
GaudiHandle & | operator= (const GaudiHandle &other)
| Assignment operator for correct ref-counting. More...
StatusCode | retrieve () const
| Retrieve the component. More...
StatusCode | release () const
| Release the component. More...
bool | isValid () const
| Check if the handle is valid (try to retrive the object is not done yet). More...
| operator bool () const
| For testing if handle has component. More...
T * | get ()
| Return the wrapped pointer, not calling retrieve() if null. More...
std::add_const_t< T > * | get () const
| Return the wrapped pointer, not calling retrieve() if null. More...
bool | isSet () const
| True if the wrapped pointer is not null. More...
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. More...
std::string | getDefaultName ()
Public Member Functions inherited from GaudiHandleBase
std::string | typeAndName () const
| The full type and name: "type/name". More...
std::string | type () const
| The concrete component class name: the part before the '/'. More...
std::string | name () const
| The instance name: the part after the '/'. More...
bool | empty () const
| Check if the handle has been set to empty string (i.e. More...
void | setTypeAndName (std::string myTypeAndName)
| The component "type/name" string. More...
void | setName (const std::string &myName)
| Set the instance name (part after the '/') without changing the class type. More...
std::string | pythonPropertyClassName () const override
| Name of the componentType with "Handle" appended. More...
std::string | messageName () const
| name used for printing messages More...
std::string | pythonRepr () const override
| Python representation of handle, i.e. More...
Public Member Functions inherited from GaudiHandleInfo
virtual | ~GaudiHandleInfo ()=default
| virtual destructor so that derived class destructor is called. More...
const std::string & | componentType () const
const std::string & | propertyName () const
| name as used in declareProperty(name,gaudiHandle) More...
void | setPropertyName (std::string propName)
| set name as used in declareProperty(name,gaudiHandle). More...
const std::string & | parentName () const
| The name of the parent. More...

## 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 Member Functions inherited from ToolHandle< T >
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. More...
Protected Member Functions inherited from GaudiHandleInfo
| GaudiHandleInfo (std::string myComponentType, std::string myParentName)
| Some basic information and helper functions shared between various handles/arrays. More...
void | setComponentType (const std::string &componentType)
| The component type. More...
void | setParentName (const std::string &parent)
| The name of the parent. More...
Protected Attributes inherited from BaseToolHandle
bool | m_enabled = true
Protected Attributes inherited from ToolHandleInfo
const IInterface * | m_parent = nullptr
bool | m_createIf {true}

## Detailed Description

### template<class T>
class PublicToolHandle< T >

Helper class to construct ToolHandle instances for public tools via the auto registering constructor.

Definition at line 308 of file ToolHandle.h.

## Constructor & Destructor Documentation

## ◆ PublicToolHandle() [1/5]

template<class T>

PublicToolHandle< T >::PublicToolHandle | ( | bool | createIf = `true` | ) |
| inline

Definition at line 310 of file ToolHandle.h.

310 : ToolHandle<T>( nullptr, createIf ) {}
ToolHandleInfo::createIf
bool createIf() const noexcept
Definition: ToolHandle.h:42
ToolHandle
Handle to be used in lieu of naked pointers to tools.
Definition: ToolHandle.h:125

## ◆ PublicToolHandle() [2/5]

template<class T>

PublicToolHandle< T >::PublicToolHandle | ( | const char * | toolTypeAndName,
|  | bool | createIf = `true`
| ) |  |
| inline

Definition at line 311 of file ToolHandle.h.

312 : PublicToolHandle{std::string{toolTypeAndName}, createIf} {}
ToolHandleInfo::createIf
bool createIf() const noexcept
Definition: ToolHandle.h:42
std::string
STL class.
PublicToolHandle
Helper class to construct ToolHandle instances for public tools via the auto registering constructor.
Definition: ToolHandle.h:308

## ◆ PublicToolHandle() [3/5]

template<class T>

PublicToolHandle< T >::PublicToolHandle | ( | const std::string & | toolTypeAndName,
|  | bool | createIf = `true`
| ) |  |
| inline

Definition at line 313 of file ToolHandle.h.

314 : ToolHandle<T>( toolTypeAndName, nullptr, createIf ) {}
ToolHandleInfo::createIf
bool createIf() const noexcept
Definition: ToolHandle.h:42
ToolHandle
Handle to be used in lieu of naked pointers to tools.
Definition: ToolHandle.h:125

## ◆ PublicToolHandle() [4/5]

template<class T>
template<typename CT = T, typename NCT = std::remove_const_t<T>>

PublicToolHandle< T >::PublicToolHandle | ( | const PublicToolHandle< NCT > & | other,
|  | std::enable_if_t< std::is_const_v< CT > &&!std::is_same_v< CT, NCT >> * | = `nullptr`
| ) |  |
| inline

Copy constructor from a non const T to const T tool handle.

Definition at line 318 of file ToolHandle.h.

320 : ToolHandle<T>( static_cast<const ToolHandle<NCT>&>( other ) ) {}
ToolHandle
Handle to be used in lieu of naked pointers to tools.
Definition: ToolHandle.h:125

## ◆ PublicToolHandle() [5/5]

template<class T>
template<class OWNER , typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>

PublicToolHandle< T >::PublicToolHandle | ( | OWNER * | owner,
|  | std::string | propName,
|  | std::string | toolType,
|  | std::string | doc = `""`
| ) |  |
| inline

Autodeclaring constructor with property propName, tool type/name and documentation.

Note
  the use std::enable_if is required to avoid ambiguities

Definition at line 325 of file ToolHandle.h.

326 : PublicToolHandle() {
327 // convert name and type to a valid type/name string
328 // - if type does not contain '/' use type/type
329 // - otherwise type is already a type/name string
330 if ( !toolType.empty() and toolType.find( '/' ) == std::string::npos ) { toolType += '/' + toolType; }
331 owner->declareTool( *this, std::move( toolType ) ).ignore();
332 auto p = owner->OWNER::PropertyHolderImpl::declareProperty( std::move( propName ), *this, std::move( doc ) );
333 p->template setOwnerType<OWNER>();
334 }
std::string::empty
T empty(T... args)
std::move
T move(T... args)
PublicToolHandle::PublicToolHandle
PublicToolHandle(bool createIf=true)
Definition: ToolHandle.h:310
std::string::find
T find(T... args)

The documentation for this class was generated from the following file:

- GaudiKernel/GaudiKernel/ToolHandle.h