|
||||
File indexing completed on 2025-01-31 10:09:00
0001 /***********************************************************************************\ 0002 * (c) Copyright 1998-2021 CERN for the benefit of the LHCb and ATLAS collaborations * 0003 * * 0004 * This software is distributed under the terms of the Apache version 2 licence, * 0005 * copied verbatim in the file "LICENSE". * 0006 * * 0007 * In applying this licence, CERN does not waive the privileges and immunities * 0008 * granted to it by virtue of its status as an Intergovernmental Organization * 0009 * or submit itself to any jurisdiction. * 0010 \***********************************************************************************/ 0011 #ifndef INTERFACES_IINCIDENTSVC_H 0012 #define INTERFACES_IINCIDENTSVC_H 0013 0014 // Include Files 0015 #include "GaudiKernel/EventContextHash.h" 0016 #include "GaudiKernel/IInterface.h" 0017 #include "GaudiKernel/Incident.h" 0018 #include <memory> 0019 #include <string> 0020 #include <vector> 0021 // Forward declarations 0022 class IIncidentListener; 0023 // class Incident; 0024 0025 /** @class IIncidentSvc IIncidentSvc.h GaudiKernel/IIncidentSvc.h 0026 0027 The interface implemented by the IncidentSvc service. It is used by 0028 Listeners to declare themselves that they are interested by Incidents 0029 of a certain type and by Incident originators. 0030 0031 @author Pere Mato 0032 */ 0033 class GAUDI_API IIncidentSvc : virtual public IInterface { 0034 public: 0035 /// InterfaceID 0036 DeclareInterfaceID( IIncidentSvc, 2, 0 ); 0037 0038 /** Add listener 0039 @param lis Listener address 0040 @param type Incident type 0041 @param priority Priority in handling incident 0042 */ 0043 virtual void addListener( IIncidentListener* lis, const std::string& type = "", long priority = 0, 0044 bool rethrow = false, bool singleShot = false ) = 0; 0045 /** Remove listener 0046 @param lis Listener address 0047 @param type Incident type 0048 */ 0049 virtual void removeListener( IIncidentListener* lis, const std::string& type = "" ) = 0; 0050 0051 //@TODO: return vector by value instead... 0052 virtual void getListeners( std::vector<IIncidentListener*>& lis, const std::string& type = "" ) const = 0; 0053 0054 /** Fire an Incident 0055 @param Incident being fired 0056 */ 0057 virtual void fireIncident( const Incident& incident ) = 0; 0058 0059 /** Listener properties */ 0060 struct Listener final { 0061 IIncidentListener* iListener{ nullptr }; 0062 long priority{ 0 }; 0063 bool rethrow{ false }; 0064 bool singleShot{ false }; 0065 }; 0066 0067 /** List of incidents and their listeners */ 0068 typedef std::vector<std::pair<std::unique_ptr<Incident>, std::vector<Listener>>> IncidentPack; 0069 0070 /** Get List of asynchronous incidents and their listeners */ 0071 virtual IIncidentSvc::IncidentPack getIncidents( const EventContext* ctx ) = 0; 0072 0073 /** Fire an Incident, Incident ownership has to be passed to the 0074 service since it is going to be accessed asynchronously 0075 @param Incident being fired 0076 */ 0077 virtual void fireIncident( std::unique_ptr<Incident> incident ) = 0; 0078 }; 0079 0080 #endif // GAUDIKERNEL_IINCIDENTSVC_H
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |