The Gaudi Framework  master (37c0b60a)
IIncidentSvc.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2024 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 #ifndef INTERFACES_IINCIDENTSVC_H
12 #define INTERFACES_IINCIDENTSVC_H
13 
14 // Include Files
16 #include <GaudiKernel/IInterface.h>
17 #include <GaudiKernel/Incident.h>
18 #include <memory>
19 #include <string>
20 #include <vector>
21 // Forward declarations
22 class IIncidentListener;
23 // class Incident;
24 
33 class GAUDI_API IIncidentSvc : virtual public IInterface {
34 public:
37 
43  virtual void addListener( IIncidentListener* lis, const std::string& type = "", long priority = 0,
44  bool rethrow = false, bool singleShot = false ) = 0;
49  virtual void removeListener( IIncidentListener* lis, const std::string& type = "" ) = 0;
50 
51  //@TODO: return vector by value instead...
52  virtual void getListeners( std::vector<IIncidentListener*>& lis, const std::string& type = "" ) const = 0;
53 
57  virtual void fireIncident( const Incident& incident ) = 0;
58 
60  struct Listener final {
61  IIncidentListener* iListener{ nullptr };
62  long priority{ 0 };
63  bool rethrow{ false };
64  bool singleShot{ false };
65  };
66 
69 
72 
77  virtual void fireIncident( std::unique_ptr<Incident> incident ) = 0;
78 };
79 
80 #endif // GAUDIKERNEL_IINCIDENTSVC_H
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:60
std::string
STL class.
IIncidentSvc::addListener
virtual void addListener(IIncidentListener *lis, const std::string &type="", long priority=0, bool rethrow=false, bool singleShot=false)=0
Add listener.
std::vector
STL class.
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:25
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:68
gaudirun.type
type
Definition: gaudirun.py:160
IInterface
Definition: IInterface.h:239
EventContext
Definition: EventContext.h:34
Incident.h
IIncidentSvc
Definition: IIncidentSvc.h:33
Incident
Definition: Incident.h:27
std::unique_ptr
STL class.
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:81
IIncidentSvc::getIncidents
virtual IIncidentSvc::IncidentPack getIncidents(const EventContext *ctx)=0
Get List of asynchronous incidents and their listeners.