| The Gaudi Framework v30r0 (c919700c)

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

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

Public Member Functions | Private Attributes | List of all members
IToolSvc::Observer Class Reference

allow call-backs when a tool is a created or retrieved More...

`#include <GaudiKernel/IToolSvc.h>`

Collaboration diagram for IToolSvc::Observer:
[legend]

## Public Member Functions
virtual | ~Observer ()
void | setUnregister (std::function< void()> unregister)
virtual void | onCreate (const IAlgTool *)
virtual void | onRetrieve (const IAlgTool *)

## Private Attributes
std::function< void()> | m_unregister

## Detailed Description

allow call-backs when a tool is a created or retrieved

class myObserver : public ITooSvc::Observer {
void onCreate(IAlgTool& tool) {
cout << "tool " << tool.name() << " created " << endl;
}
void onRetrieve(IAlgTool& tool) {
cout << "someone requested " << tool.name() <<endl;
}
}
myObserver *observer = new myObserver;
IToolSvc* svc = ...
svc->registerObserver(observer);

IToolSvc implementations will call 'Observer::onCreate' when a tool is created, and 'Observer::onRetrieve' if a tool is retrieved.

The user is responsible of the life time of the object and must un-register it before it is deleted (e.g. during the finalization).

Definition at line 223 of file IToolSvc.h.

## Constructor & Destructor Documentation

virtual IToolSvc::Observer::~Observer | ( |  | ) |
| inline virtual

Definition at line 226 of file IToolSvc.h.

227 {
228 if ( m_unregister ) m_unregister();
229 }
IToolSvc::Observer::m_unregister
std::function< void()> m_unregister
Definition: IToolSvc.h:236

## Member Function Documentation

virtual void IToolSvc::Observer::onCreate | ( | const IAlgTool * |  | ) |
| inline virtual

Definition at line 232 of file IToolSvc.h.

232 {}

virtual void IToolSvc::Observer::onRetrieve | ( | const IAlgTool * |  | ) |
| inline virtual

Definition at line 233 of file IToolSvc.h.

233 {}

void IToolSvc::Observer::setUnregister | ( | std::function< void()> | unregister | ) |
| inline

Definition at line 230 of file IToolSvc.h.

230 { m_unregister = std::move( unregister ); }
IToolSvc::Observer::m_unregister
std::function< void()> m_unregister
Definition: IToolSvc.h:236
std::move
T move(T...args)

## Member Data Documentation

std::function<void()> IToolSvc::Observer::m_unregister
| private

Definition at line 236 of file IToolSvc.h.

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

- GaudiKernel/GaudiKernel/IToolSvc.h