The Gaudi Framework  master (d98a2936)
IIncidentSvc.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2025 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #pragma once
12 
14 #include <GaudiKernel/IInterface.h>
15 #include <GaudiKernel/Incident.h>
16 #include <memory>
17 #include <string>
18 #include <vector>
19 
20 class IIncidentListener;
21 
30 class GAUDI_API IIncidentSvc : virtual public IInterface {
31 public:
34 
40  virtual void addListener( IIncidentListener* lis, const std::string& type = "", long priority = 0,
41  bool rethrow = false, bool singleShot = false ) = 0;
46  virtual void removeListener( IIncidentListener* lis, const std::string& type = "" ) = 0;
47 
48  //@TODO: return vector by value instead...
49  virtual void getListeners( std::vector<IIncidentListener*>& lis, const std::string& type = "" ) const = 0;
50 
54  virtual void fireIncident( const Incident& incident ) = 0;
55 
57  struct Listener final {
58  IIncidentListener* iListener{ nullptr };
59  long priority{ 0 };
60  bool rethrow{ false };
61  bool singleShot{ false };
62  };
63 
65  typedef std::vector<std::pair<std::unique_ptr<Incident>, std::vector<Listener>>> IncidentPack;
66 
69 
74  virtual void fireIncident( std::unique_ptr<Incident> incident ) = 0;
75 };
IIncidentSvc::fireIncident
virtual void fireIncident(std::unique_ptr< Incident > incident)=0
Fire an Incident, Incident ownership has to be passed to the service since it is going to be accessed...
IIncidentSvc::Listener
Listener properties.
Definition: IIncidentSvc.h:57
IIncidentSvc::addListener
virtual void addListener(IIncidentListener *lis, const std::string &type="", long priority=0, bool rethrow=false, bool singleShot=false)=0
Add listener.
IIncidentSvc::getListeners
virtual void getListeners(std::vector< IIncidentListener * > &lis, const std::string &type="") const =0
IIncidentSvc::removeListener
virtual void removeListener(IIncidentListener *lis, const std::string &type="")=0
Remove listener.
EventContextHash.h
IIncidentSvc::fireIncident
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
IIncidentListener
Definition: IIncidentListener.h:23
IIncidentSvc::DeclareInterfaceID
DeclareInterfaceID(IIncidentSvc, 2, 0)
InterfaceID.
GaudiPython.Pythonizations.ctx
ctx
Definition: Pythonizations.py:578
IInterface.h
IIncidentSvc::IncidentPack
std::vector< std::pair< std::unique_ptr< Incident >, std::vector< Listener > > > IncidentPack
List of incidents and their listeners.
Definition: IIncidentSvc.h:65
gaudirun.type
type
Definition: gaudirun.py:160
IInterface
Definition: IInterface.h:225
EventContext
Definition: EventContext.h:34
Incident.h
IIncidentSvc
Definition: IIncidentSvc.h:30
Incident
Definition: Incident.h:24
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:49
IIncidentSvc::getIncidents
virtual IIncidentSvc::IncidentPack getIncidents(const EventContext *ctx)=0
Get List of asynchronous incidents and their listeners.