The Gaudi Framework  master (82fdf313)
Loading...
Searching...
No Matches
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
16#include <memory>
17#include <string>
18#include <vector>
19
21
30class GAUDI_API IIncidentSvc : virtual public IInterface {
31public:
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 {
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};
#define GAUDI_API
Definition Kernel.h:49
This class represents an entry point to all the event specific data.
The interface implemented by any class wanting to listen to Incidents.
The interface implemented by the IncidentSvc service.
virtual IIncidentSvc::IncidentPack getIncidents(const EventContext *ctx)=0
Get List of asynchronous incidents and their listeners.
std::vector< std::pair< std::unique_ptr< Incident >, std::vector< Listener > > > IncidentPack
List of incidents and their listeners.
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...
DeclareInterfaceID(IIncidentSvc, 2, 0)
InterfaceID.
virtual void getListeners(std::vector< IIncidentListener * > &lis, const std::string &type="") const =0
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
virtual void removeListener(IIncidentListener *lis, const std::string &type="")=0
Remove listener.
virtual void addListener(IIncidentListener *lis, const std::string &type="", long priority=0, bool rethrow=false, bool singleShot=false)=0
Add listener.
Definition of the basic interface.
Definition IInterface.h:225
Base class for all Incidents (computing events).
Definition Incident.h:24
Listener properties.
IIncidentListener * iListener