The Gaudi Framework  v33r1 (b1225454)
IIncidentSvc.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 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 
59  class IncidentPack {
60  public:
63  IncidentPack( IncidentPack&& o ) : incidents( std::move( o.incidents ) ), listeners( std::move( o.listeners ) ){};
65  incidents = std::move( o.incidents );
66  listeners = std::move( o.listeners );
67  return *this;
68  };
70  };
71 
72  virtual IIncidentSvc::IncidentPack getIncidents( const EventContext* ctx ) = 0;
77  virtual void fireIncident( std::unique_ptr<Incident> incident ) = 0;
78 };
79 
80 #endif // GAUDIKERNEL_IINCIDENTSVC_H
STL namespace.
This class represents an entry point to all the event specific data.
Definition: EventContext.h:34
std::vector< std::unique_ptr< Incident > > incidents
Definition: IIncidentSvc.h:61
STL class.
The interface implemented by any class wanting to listen to Incidents.
Definition of the basic interface.
Definition: IInterface.h:254
IncidentPack(IncidentPack &&o)
Definition: IIncidentSvc.h:63
std::vector< std::vector< IIncidentListener * > > listeners
Definition: IIncidentSvc.h:62
T move(T... args)
#define DeclareInterfaceID(iface, major, minor)
Macro to declare the interface ID when using the new mechanism of extending and implementing interfac...
Definition: IInterface.h:23
IncidentPack & operator=(IncidentPack &&o)
Definition: IIncidentSvc.h:64
STL class.
Base class for all Incidents (computing events).
Definition: Incident.h:27
#define GAUDI_API
Definition: Kernel.h:81
The interface implemented by the IncidentSvc service.
Definition: IIncidentSvc.h:33