| The Gaudi Framework v30r0 (c919700c)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Types | Public Member Functions | List of all members
IToolSvc Class Referenceabstract

The interface implemented by the IToolSvc base class. More...

`#include <GaudiKernel/IToolSvc.h>`

Inheritance diagram for IToolSvc:
[legend]
Collaboration diagram for IToolSvc:
[legend]

## Classes
class | Observer
| allow call-backs when a tool is a created or retrieved More...

## Public Types
typedef std::list< IAlgTool * > | ListTools
Public Types inherited from IInterface
enum | Status { SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR }
| Return status. More...
using | iid = Gaudi::InterfaceId< IInterface, 0, 0 >
| Interface ID. More...
using | ext_iids = Gaudi::interface_list< iid >
| Extra interfaces. More...

## Public Member Functions
| DeclareInterfaceID (IToolSvc, 2, 1)
| InterfaceID. More...
virtual StatusCode | retrieve (const std::string &type, const InterfaceID &iid, IAlgTool *&tool, const IInterface *parent=0, bool createIf=true)=0
| Retrieve tool with tool dependent part of the name automatically assigned. More...
virtual StatusCode | retrieve (const std::string &type, const std::string &name, const InterfaceID &iid, IAlgTool *&tool, const IInterface *parent=0, bool createIf=true)=0
| Retrieve tool with tool dependent part of the name specified by the requester. More...
virtual std::vector< std::string > | getInstances (const std::string &toolType)=0
| Get the names of all instances of tools of a given type. More...
virtual std::vector< std::string > | getInstances () const =0
| Get the names all tool instances. More...
virtual std::vector< IAlgTool * > | getTools () const =0
| Get pointers to all tool instances. More...
virtual StatusCode | releaseTool (IAlgTool *tool)=0
| Release the tool. More...
template<class T >
StatusCode | retrieveTool (const std::string &type, T *&tool, const IInterface *parent=nullptr, bool createIf=true)
| Retrieve specified tool sub-type with tool dependent part of the name automatically assigned. More...
template<class T >
StatusCode | retrieveTool (const std::string &type, const std::string &name, T *&tool, const IInterface *parent=nullptr, bool createIf=true)
| Retrieve specified tool sub-type with tool dependent part of the name tool dependent part of the name specified by the requester. More...
virtual void | registerObserver (Observer *obs)=0
Public Member Functions inherited from IInterface
virtual void * | i_cast (const InterfaceID &) const =0
| main cast function More...
virtual std::vector< std::string > | getInterfaceNames () const =0
| Returns a vector of strings containing the names of all the implemented interfaces. More...
virtual unsigned long | addRef ()=0
| Increment the reference count of Interface instance. More...
virtual unsigned long | release ()=0
| Release Interface instance. More...
virtual unsigned long | refCount () const =0
| Current reference count. More...
virtual StatusCode | queryInterface (const InterfaceID &ti, void **pp)=0
| Set the void** to the pointer to the requested interface of the instance. More...
virtual | ~IInterface ()=default
| Virtual destructor. More...

## Additional Inherited Members
Static Public Member Functions inherited from IInterface
static const InterfaceID & | interfaceID ()
| Return an instance of InterfaceID identifying the interface. More...

## Detailed Description

The interface implemented by the IToolSvc base class.

Author
  G.Corti

Definition at line 19 of file IToolSvc.h.

## Member Typedef Documentation

typedef std::list<IAlgTool*> IToolSvc::ListTools

Definition at line 26 of file IToolSvc.h.

## Member Function Documentation

IToolSvc::DeclareInterfaceID | ( | IToolSvc | ,
|  | 2 | ,
|  | 1 |
| ) |  |

InterfaceID.

virtual std::vector<std::string> IToolSvc::getInstances | ( | const std::string & | toolType | ) |
| pure virtual

Get the names of all instances of tools of a given type.

Parameters

  toolType | type of tool

virtual std::vector<std::string> IToolSvc::getInstances | ( |  | ) | const
| pure virtual

Get the names all tool instances.

virtual std::vector<IAlgTool*> IToolSvc::getTools | ( |  | ) | const
| pure virtual

Get pointers to all tool instances.

virtual void IToolSvc::registerObserver | ( | Observer * | obs | ) |
| pure virtual

virtual StatusCode IToolSvc::releaseTool | ( | IAlgTool * | tool | ) |
| pure virtual

Release the tool.

Parameters

  tool | to be released

virtual StatusCode IToolSvc::retrieve | ( | const std::string & | type,
|  | const InterfaceID & | iid,
|  | IAlgTool *& | tool,
|  | const IInterface * | parent = `0`,
|  | bool | createIf = `true`
| ) |  |
| pure virtual

Retrieve tool with tool dependent part of the name automatically assigned.

By default a tool will be created if it does not exist, unless otherwise specified. By default it will be a common tool unless a parent is specified. The parent of a common tool is automatically taken as the ToolSvc itself.

Parameters

  type | AlgTool type name
  iid | the unique interface identifier
  tool | returned tool
  parent | constant reference to the parent (def=none)
  createIf | creation flag (def=create if not existing)

virtual StatusCode IToolSvc::retrieve | ( | const std::string & | type,
|  | const std::string & | name,
|  | const InterfaceID & | iid,
|  | IAlgTool *& | tool,
|  | const IInterface * | parent = `0`,
|  | bool | createIf = `true`
| ) |  |
| pure virtual

Retrieve tool with tool dependent part of the name specified by the requester.

By default a tool will be created if it does not exist, unless otherwise specified. By default it will be a common tool unless a parent is specified. The parent of a common tool is automatically taken as the ToolSvc itself.

Parameters

  type | AlgTool type name
  name | name to be assigned to tool dependent part of the name
  iid | the unique interface identifier
  tool | returned tool
  parent | constant reference to parent (def=none)
  createIf | creation flag (def=create if not existing)

template<class T >

StatusCode IToolSvc::retrieveTool | ( | const std::string & | type,
|  | T *& | tool,
|  | const IInterface * | parent = `nullptr`,
|  | bool | createIf = `true`
| ) |  |
| inline

Retrieve specified tool sub-type with tool dependent part of the name automatically assigned.

Internally it uses the corresponding IToolSvc::retrieve and does the dynamic casting.

IToolSvc* svc = ... ;
IMyTool* tool = 0 ;
StatusCode sc = svc->retrieveTool ( "MyToolType" , tool ) ;

For this example public tool of type `'MyToolType'` will be retrieved from Tool Service (created on demand). The full name of the tool instance is set to be `ToolSvc.MyToolType`

IToolSvc* svc = ... ;
IAlgorithm* alg = ... ;
IMyTool* tool = 0 ;
StatusCode sc = svc->retrieveTool ( "MyToolType" , tool , alg ) ;

For this example the private tool of type `'MyToolType'` will be retrieved from Tool Service (created on demand). The full name of the tool instance is set to be `<AlgName>.MyToolType` , where `<AlgName>` is a name of the algorithm.

IToolSvc* svc = ... ;
IMyTool* tool = 0 ;
StatusCode sc = svc->retrieveTool ( "MyToolType/MyToolName" , tool ) ;

For this example public tool of type `'MyToolType'` will be retrieved from Tool Service (created on demand). The full name of the tool instance is set to be `ToolSvc.MyToolName`

IToolSvc* svc = ... ;
IAlgorithm* alg = ... ;
IMyTool* tool = 0 ;
StatusCode sc = svc ->
retrieveTool ( "MyToolType/MyToolName" , tool , alg ) ;

For this example the private tool of type `'MyToolType'` will be retrieved from Tool Service (created on demand). The full name of the tool instance is set to be `<AlgName>.MyToolName` , where `<AlgName>` is a name of the algorithm.

Parameters

  tool | returned tool
  parent | constant reference to parent (def=none)
  createIf | creation flag (def=create if not existing)

Definition at line 139 of file IToolSvc.h.

140 {
141 return retrieve( type, T::interfaceID(), (IAlgTool*&)tool, parent, createIf );
142 }
IToolSvc::retrieve
virtual StatusCode retrieve(const std::string &type, const InterfaceID &iid, IAlgTool *&tool, const IInterface *parent=0, bool createIf=true)=0
Retrieve tool with tool dependent part of the name automatically assigned.
IAlgTool
The interface implemented by the AlgTool base class.
Definition: IAlgTool.h:23
template<class T >

StatusCode IToolSvc::retrieveTool | ( | const std::string & | type,
|  | const std::string & | name,
|  | T *& | tool,
|  | const IInterface * | parent = `nullptr`,
|  | bool | createIf = `true`
| ) |  |
| inline

Retrieve specified tool sub-type with tool dependent part of the name tool dependent part of the name specified by the requester.

Internally it uses the corresponding IToolSvc::retrieve and does the dynamic casting.

IToolSvc* svc = ... ;
IMyTool* tool = 0 ;
StatusCode sc = svc->retrieveTool ( "MyToolType" ,
"MyToolName" , tool ) ;

For this example public tool of type `'MyToolType'` will be retrieved from Tool Service (created on demand). The full name of the tool instance is set to be `ToolSvc.MyToolName`

IToolSvc* svc = ... ;
IAlgorithm* alg = ... ;
IMyTool* tool = 0 ;
StatusCode sc = svc->retrieveTool ( "MyToolType" ,
"MyToolName" , tool , alg ) ;

For this example the private tool of type `'MyToolType'` will be retrieved from Tool Service (created on demand). The full name of the tool instance is set to be `<AlgName>.MyToolName` , where `<AlgName>` is a name of the algorithm.

If `name` is empty (`""`) it is assumed to be equal to the `type`

Parameters

  type | AlgTool type name
  name | name to be assigned to tool dependent part of the name
  tool | returned tool
  parent | constant reference to parent (def=none)
  createIf | creation flag (def=create if not existing)

Definition at line 188 of file IToolSvc.h.

190 {
191 return retrieve( type, name, T::interfaceID(), (IAlgTool*&)tool, parent, createIf );
192 }
IToolSvc::retrieve
virtual StatusCode retrieve(const std::string &type, const InterfaceID &iid, IAlgTool *&tool, const IInterface *parent=0, bool createIf=true)=0
Retrieve tool with tool dependent part of the name automatically assigned.
IAlgTool
The interface implemented by the AlgTool base class.
Definition: IAlgTool.h:23

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

- GaudiKernel/GaudiKernel/IToolSvc.h