Gaudi Framework, version v25r0

Home   Generated: Mon Feb 17 2014
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Private Attributes | List of all members
ToolHandle< T > Class Template Reference

Handle to be used in lieu of naked pointers to tools. More...

#include <GaudiKernel/ToolHandle.h>

Inheritance diagram for ToolHandle< T >:
Inheritance graph
[legend]
Collaboration diagram for ToolHandle< T >:
Collaboration graph
[legend]

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.
 
- Public Member Functions inherited from ToolHandleInfo
virtual ~ToolHandleInfo ()
 
bool isPublic () const
 
bool createIf () const
 
const IInterfaceparent () const
 
const std::string toolComponentType (const IInterface *parent) const
 
const std::string toolParentName (const IInterface *parent) const
 
- Public Member Functions inherited from GaudiHandle< T >
 GaudiHandle (const GaudiHandle &other)
 Copy constructor needed for correct ref-counting.
 
GaudiHandleoperator= (const GaudiHandle &other)
 Assignment operator for correct ref-counting.
 
StatusCode retrieve () const
 Retrieve the component.
 
StatusCode release () const
 Release the component.
 
 operator bool () const
 For testing if handle has component.
 
T & operator* ()
 
T * operator-> ()
 
T & operator* () const
 
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
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 (const std::string &myTypeAndName)
 The component "type/name" string.
 
void setName (const std::string &myName)
 Set the instance name (part after the '/') without changing the class type.
 
const std::string pythonPropertyClassName () const
 Name of the componentType with "Handle" appended.
 
const std::string messageName () const
 name used for printing messages
 
virtual const std::string pythonRepr () const
 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::stringcomponentType () const
 
const std::stringpropertyName () const
 name as used in declareProperty(name,gaudiHandle)
 
void setPropertyName (const std::string &propName)
 set name as used in declareProperty(name,gaudiHandle).
 
const std::stringparentName () const
 The name of the parent.
 

Private Attributes

ServiceHandle< IToolSvcm_pToolSvc
 

Additional Inherited Members

- Protected Member Functions inherited from ToolHandleInfo
 ToolHandleInfo (const IInterface *parent=0, bool createIf=true)
 
- Protected Member Functions inherited from GaudiHandle< T >
 GaudiHandle (const std::string &myTypeAndName, const std::string &myComponentType, const std::string &myParentName)
 

Detailed Description

template<class T>
class ToolHandle< T >

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.

Author
Wim Lavrijsen WLavr.nosp@m.ijse.nosp@m.n@lbl.nosp@m..gov
Marti.nosp@m.n.Wo.nosp@m.udstr.nosp@m.a@ce.nosp@m.rn.ch

Definition at line 24 of file PropertyMgr.h.

Constructor & Destructor Documentation

template<class T>
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.

template<class T>
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:

T*& tool ,
const IInterface* parent = 0 ,
bool createIf = true )
Parameters
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.

Member Function Documentation

template<class T>
StatusCode ToolHandle< T >::release ( ) const
inline

Release the AlgTool.

Function must be repeated here to avoid hiding the function release( T*& )

Definition at line 129 of file ToolHandle.h.

{ // not really const, because it updates m_pObject
}
template<class T>
virtual StatusCode ToolHandle< T >::release ( T *  algTool) const
inlinevirtual

Do the real release of the AlgTool.

Reimplemented from GaudiHandle< T >.

Definition at line 141 of file ToolHandle.h.

{
return m_pToolSvc->releaseTool( algTool );
}
template<class T>
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*& )

Definition at line 123 of file ToolHandle.h.

{ // not really const, because it updates m_pObject
}
template<class T>
virtual StatusCode ToolHandle< T >::retrieve ( T *&  algTool) const
inlinevirtual

Do the real retrieval of the AlgTool.

Implements GaudiHandle< T >.

Definition at line 134 of file ToolHandle.h.

Member Data Documentation

template<class T>
ServiceHandle<IToolSvc> ToolHandle< T >::m_pToolSvc
mutableprivate

Definition at line 149 of file ToolHandle.h.


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

Generated at Mon Feb 17 2014 14:38:13 for Gaudi Framework, version v25r0 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004