Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 10:09:00

0001 /***********************************************************************************\
0002 * (c) Copyright 1998-2019 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 GAUDI_INCIDENT_H
0012 #define GAUDI_INCIDENT_H
0013 
0014 // Include files
0015 #include "GaudiKernel/EventContext.h"
0016 #include "GaudiKernel/Kernel.h"
0017 #include <string>
0018 
0019 /** @class Incident Incident.h GaudiKernel/Incident.h
0020  *
0021  *  Base class for all Incidents (computing events).
0022  *
0023  *  @author P. Mato
0024  *  @date   2001/01/19
0025  */
0026 
0027 class GAUDI_API Incident {
0028 
0029 public:
0030   /// Default Constructor
0031   Incident( const std::string& source, ///< Incident source (service or algorithm name)
0032             const std::string& type    ///< Incident type
0033   );
0034 
0035   Incident( const std::string&  source, ///< Incident source (service or algorithm name)
0036             const std::string&  type,   ///< Incident type
0037             const EventContext& ctx     ///< EventContext
0038             )
0039       : m_source( source ), m_type( type ), m_ctx( ctx ) {}
0040 
0041   /// Destructor
0042   virtual ~Incident() = default;
0043 
0044   /** Access to the incident type
0045    *
0046    *  @return string descriptor for the incident type
0047    */
0048   const std::string& type() const { return m_type; }
0049 
0050   /** Access to the source of the incident
0051    *
0052    *  @return service or algorithm name that initiated the incident
0053    */
0054   const std::string& source() const { return m_source; }
0055 
0056   /** Access to the EventContext of the source of the incident
0057    *
0058    *  @return EventContext of the component that initiated the incident
0059    */
0060   EventContext context() const { return m_ctx; }
0061 
0062 private:
0063   std::string  m_source; ///< Incident source
0064   std::string  m_type;   ///< incident type
0065   EventContext m_ctx;    ///< Event Context when Incident created
0066 };
0067 
0068 #ifndef _inc_types_impl_
0069 #  define _inc_type_( x ) extern const std::string x
0070 #else
0071 #  define _inc_type_( x )                                                                                              \
0072     extern const std::string x;                                                                                        \
0073     const std::string        x { #x }
0074 #endif
0075 /** @namespace IncidentType
0076  *
0077  *  Namespace for pre-defined common incident types
0078  *
0079  *  @author P. Mato
0080  *  @date   2001/01/19
0081  *  @author R. Lambert
0082  *  @date   2009/09/03
0083  */
0084 namespace IncidentType {
0085   _inc_type_( BeginEvent ); ///< Processing of a new event has started
0086   _inc_type_( EndEvent );   ///< Processing of the last event has finished
0087   _inc_type_( BeginRun );   ///< Processing of a new run has started
0088   _inc_type_( EndRun );     ///< Processing of the last run has finished
0089   _inc_type_( EndStream );  ///< Processing of the stream has finished
0090 
0091   _inc_type_( AbortEvent ); ///< Stop processing the current event and pass to te next one
0092 
0093 // Added by R. Lambert 2009-09-03, for summary services
0094 // define a preprocessor macro to allow backward-compatibility
0095 #define GAUDI_FILE_INCIDENTS
0096 
0097   _inc_type_( BeginOutputFile );   ///< a new output file has been created
0098   _inc_type_( FailOutputFile );    ///< could not create or write to this file
0099   _inc_type_( WroteToOutputFile ); ///< the output file was written to in this event
0100   _inc_type_( EndOutputFile );     ///< an output file has been finished
0101 
0102   _inc_type_( BeginInputFile ); ///< a new input file has been started
0103   _inc_type_( FailInputFile );  ///< could not open or read from this file
0104   _inc_type_( EndInputFile );   ///< an input file has been finished
0105 
0106   _inc_type_( CorruptedInputFile ); ///< the input file has shown a corruption
0107 
0108   /// Incident raised just before entering loop over the algorithms.
0109   _inc_type_( BeginProcessing );
0110   /// Incident raised just after the loop over the algorithms (note: before the execution of OutputStreams).
0111   _inc_type_( EndProcessing );
0112 
0113   /// ONLY For Services that need something after they've been finalized.
0114   /// Caveat Emptor: Don't use unless you're a Service or know you'll exist
0115   ///                after all services have been finalized!!!
0116   _inc_type_( SvcPostFinalize );
0117 } // namespace IncidentType
0118 #undef _inc_type_
0119 
0120 #endif // GAUDI_INCIDENT_H