The Gaudi Framework  master (82fdf313)
Loading...
Searching...
No Matches
Guards.cpp
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\***********************************************************************************/
12#include <GaudiKernel/Guards.h>
14#include <GaudiKernel/System.h>
15#include <exception>
16
24
26 log << MSG::FATAL << System::typeinfoName( typeid( exc ) ) << "('" << exc.tag() << "') is caught!" << endmsg;
27 log << MSG::ERROR << exc << endmsg;
28 m_sc = exc.code();
29}
30
31void Gaudi::Guards::ExceptionGuard::handle( const std::exception& exc, MsgStream& log ) {
32 log << MSG::FATAL << System::typeinfoName( typeid( exc ) ) << " is caught!" << endmsg;
33 log << MSG::ERROR << exc.what() << endmsg;
34}
35
37 log << MSG::FATAL << "UNKNOWN exception is caught!" << endmsg;
38}
39
41
42Gaudi::Guards::AuditorGuard::AuditorGuard( std::string name, IAuditor* svc, std::string const& evt,
43 EventContext const& context )
44 : m_objName( name ), m_svc( svc ), m_evt( evt ), m_context( context ) {
45 i_before();
46}
47
48Gaudi::Guards::AuditorGuard::AuditorGuard( std::string name, IAuditor* svc, std::string const& evt,
49 StatusCode const& sc, EventContext const& context )
50 : m_objName( name ), m_svc( svc ), m_evt( evt ), m_sc( &sc ), m_context( context ) {
51 i_before();
52}
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition MsgStream.h:198
This class represents an entry point to all the event specific data.
std::string const m_evt
Event type.
Definition Guards.h:226
SmartIF< IAuditor > m_svc
auditor service
Definition Guards.h:224
const EventContext & m_context
Pointer to a EventContext instance, to be passed to the "before" and "after" function If given,...
Definition Guards.h:234
AuditorGuard(std::string name, IAuditor *svc, std::string const &evt, EventContext const &context={})
Definition Guards.cpp:42
std::string m_objName
the guarded object name (if there is no INamedInterface)
Definition Guards.h:222
StatusCode const * m_sc
Pointer to a status code instance, to be passed to the "after" function if needed The instance must h...
Definition Guards.h:230
void handle(const GaudiException &e, MsgStream &s)
local handler of GaudiException
Definition Guards.cpp:25
StatusCode m_sc
status code : result of function evaluation
Definition Guards.h:157
The IAuditor is the interface implemented by the Auditor base class.
Definition IAuditor.h:26
Define general base for Gaudi exception.
virtual const StatusCode & code() const
StatusCode for Exception.
virtual const std::string & tag() const
name tag for the exception, or exception type
Definition of the MsgStream class used to transmit messages.
Definition MsgStream.h:29
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
@ FATAL
Definition IMessageSvc.h:22
@ ERROR
Definition IMessageSvc.h:22
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition System.cpp:260