|
Gaudi Framework, version v22r4 |
| Home | Generated: Fri Sep 2 2011 |
Handle to be used in lieu of naked pointers to tools. More...
#include <GaudiKernel/ToolHandle.h>


Public Member Functions | |
| ToolHandle (const IInterface *parent=0, bool createIf=true) | |
| Constructor for a tool with default tool type and name. | |
| ToolHandle (const std::string &toolTypeAndName, const IInterface *parent=0, bool createIf=true) | |
| Create a handle ('smart pointer') to a tool. | |
| StatusCode | retrieve () const |
| Retrieve the AlgTool. | |
| StatusCode | release () const |
| Release the AlgTool. | |
| virtual StatusCode | retrieve (T *&algTool) const |
| Do the real retrieval of the AlgTool. | |
| virtual StatusCode | release (T *algTool) const |
| Do the real release of the AlgTool. | |
Private Attributes | |
| ServiceHandle< IToolSvc > | m_pToolSvc |
Handle to be used in lieu of naked pointers to tools.
This allows better control through the framework of tool loading and usage. T is the AlgTool interface class (or concrete class) of the tool to use, and must derive from IAlgTool.
Definition at line 80 of file ToolHandle.h.
| ToolHandle< T >::ToolHandle | ( | const IInterface * | parent = 0, |
| bool | createIf = true |
||
| ) | [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 88 of file ToolHandle.h.
: ToolHandleInfo(parent,createIf), GaudiHandle<T>( GaudiHandle<T>::getDefaultType(), ToolHandleInfo::toolComponentType(parent), ToolHandleInfo::toolParentName(parent) ), m_pToolSvc( "ToolSvc", GaudiHandleBase::parentName() ) {}
| ToolHandle< T >::ToolHandle | ( | const std::string & | toolTypeAndName, |
| const IInterface * | parent = 0, |
||
| bool | createIf = true |
||
| ) | [inline] |
Create a handle ('smart pointer') to a tool.
The arguments are passed on to ToolSvc, and have the same meaning:
StatusCode ToolSvc::retrieveTool ( const std::string& type , T*& tool , const IInterface* parent = 0 , bool createIf = true )
| 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 113 of file ToolHandle.h.
: ToolHandleInfo(parent,createIf), GaudiHandle<T>( toolTypeAndName, ToolHandleInfo::toolComponentType(parent), ToolHandleInfo::toolParentName(parent) ), m_pToolSvc( "ToolSvc", GaudiHandleBase::parentName() ) {}
| StatusCode ToolHandle< T >::release | ( | ) | const [inline] |
Release the AlgTool.
Function must be repeated here to avoid hiding the function release( T*& )
Reimplemented from GaudiHandle< T >.
Definition at line 129 of file ToolHandle.h.
{ // not really const, because it updates m_pObject
return GaudiHandle<T>::release();
}
| virtual StatusCode ToolHandle< T >::release | ( | T * | algTool ) | const [inline, virtual] |
Do the real release of the AlgTool.
Reimplemented from GaudiHandle< T >.
Definition at line 141 of file ToolHandle.h.
{
return m_pToolSvc->releaseTool( algTool );
}
| virtual StatusCode ToolHandle< T >::retrieve | ( | T *& | algTool ) | const [inline, virtual] |
Do the real retrieval of the AlgTool.
Implements GaudiHandle< T >.
Definition at line 134 of file ToolHandle.h.
{
return m_pToolSvc->retrieve( GaudiHandleBase::typeAndName(), T::interfaceID(),
(IAlgTool*&)(algTool),
ToolHandleInfo::parent(), ToolHandleInfo::createIf() );
}
| StatusCode ToolHandle< T >::retrieve | ( | ) | const [inline] |
Retrieve the AlgTool.
Release existing tool if needed. Function must be repeated here to avoid hiding the function retrieve( T*& )
Reimplemented from GaudiHandle< T >.
Definition at line 123 of file ToolHandle.h.
{ // not really const, because it updates m_pObject
return GaudiHandle<T>::retrieve();
}
ServiceHandle<IToolSvc> ToolHandle< T >::m_pToolSvc [mutable, private] |
Definition at line 149 of file ToolHandle.h.