| # Gaudi Framework, version v21r10p1 |

Home |  | Generated: 29 Jul 2010

# IToolSvc Class Reference

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

`#include <GaudiKernel/IToolSvc.h>`

Inheritance diagram for IToolSvc:

[legend]
Collaboration diagram for IToolSvc:

[legend]

List of all members.

## Public Member Functions
| DeclareInterfaceID (IToolSvc, 2, 0)
| InterfaceID.
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.
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.
virtual std::vector< std::string > | getInstances (const std::string &toolType)=0
| Get all instance of tool by type.
virtual StatusCode | releaseTool (IAlgTool *tool)=0
| Release the tool.
template<class T>
StatusCode | retrieveTool (const std::string &type, T *&tool, const IInterface *parent=0, bool createIf=true)
| Retrieve specified tool sub-type with tool dependent part of the name automatically assigned.
template<class T>
StatusCode | retrieveTool (const std::string &type, const std::string &name, T *&tool, const IInterface *parent=0, 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.
virtual void | registerObserver (Observer *obs)=0
virtual void | unRegisterObserver (Observer *obs)=0
## Classes
class | Observer
| allow call-backs when a tool is a created or retrieved More...

## Detailed Description

The interface implemented by the IToolSvc base class.

Author:
  G.Corti

Definition at line 17 of file IToolSvc.h.

## Member Function Documentation

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

InterfaceID.

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)

Implemented in ToolSvc.

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)

Implemented in ToolSvc.

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

Get all instance of tool by type.

Parameters:

  | toolType | type of tool

Implemented in ToolSvc.

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

Release the tool.

Parameters:

  | tool | to be released

Implemented in ToolSvc.

template<class T>

StatusCode IToolSvc::retrieveTool | ( | const std::string & | type,
|  | T *& | tool,
|  | const IInterface * | parent = `0`,
|  | 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 133 of file IToolSvc.h.

    00137   {
    00138     return retrieve( type,
    00139                      T::interfaceID(),
    00140                      (IAlgTool*&)tool,
    00141                      parent,
    00142                      createIf );
    00143   }

template<class T>

StatusCode IToolSvc::retrieveTool | ( | const std::string & | type,
|  | const std::string & | name,
|  | T *& | tool,
|  | const IInterface * | parent = `0`,
|  | 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 189 of file IToolSvc.h.

    00194   {
    00195     return retrieve ( type,
    00196                       name,
    00197                       T::interfaceID(),
    00198                       (IAlgTool*&)tool,
    00199                       parent,
    00200                       createIf );
    00201   }

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

Implemented in ToolSvc.

virtual void IToolSvc::unRegisterObserver | ( | Observer * | obs | ) | `[pure virtual]`

Implemented in ToolSvc.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r10p1/GaudiKernel/GaudiKernel/IToolSvc.h