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
\***********************************************************************************/
11
#include <
GaudiKernel/GaudiException.h
>
12
#include <
GaudiKernel/Guards.h
>
13
#include <
GaudiKernel/MsgStream.h
>
14
#include <
GaudiKernel/System.h
>
15
#include <exception>
16
24
25
void
Gaudi::Guards::ExceptionGuard::handle
(
const
GaudiException
& exc,
MsgStream
& log ) {
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
31
void
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
36
void
Gaudi::Guards::ExceptionGuard::handle
(
MsgStream
& log ) {
37
log <<
MSG::FATAL
<<
"UNKNOWN exception is caught!"
<<
endmsg
;
38
}
39
40
Gaudi::Guards::ExceptionGuard::~ExceptionGuard
() {
m_sc
.ignore(); }
41
42
Gaudi::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
48
Gaudi::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
}
GaudiException.h
Guards.h
MsgStream.h
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition
MsgStream.h:198
System.h
EventContext
This class represents an entry point to all the event specific data.
Definition
EventContext.h:34
Gaudi::Guards::AuditorGuard::m_evt
std::string const m_evt
Event type.
Definition
Guards.h:226
Gaudi::Guards::AuditorGuard::m_svc
SmartIF< IAuditor > m_svc
auditor service
Definition
Guards.h:224
Gaudi::Guards::AuditorGuard::m_context
const EventContext & m_context
Pointer to a EventContext instance, to be passed to the "before" and "after" function If given,...
Definition
Guards.h:234
Gaudi::Guards::AuditorGuard::i_before
void i_before()
Definition
Guards.h:236
Gaudi::Guards::AuditorGuard::AuditorGuard
AuditorGuard(std::string name, IAuditor *svc, std::string const &evt, EventContext const &context={})
Definition
Guards.cpp:42
Gaudi::Guards::AuditorGuard::m_objName
std::string m_objName
the guarded object name (if there is no INamedInterface)
Definition
Guards.h:222
Gaudi::Guards::AuditorGuard::m_sc
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
Gaudi::Guards::ExceptionGuard::handle
void handle(const GaudiException &e, MsgStream &s)
local handler of GaudiException
Definition
Guards.cpp:25
Gaudi::Guards::ExceptionGuard::m_sc
StatusCode m_sc
status code : result of function evaluation
Definition
Guards.h:157
Gaudi::Guards::ExceptionGuard::~ExceptionGuard
~ExceptionGuard()
destructor
Definition
Guards.cpp:40
Gaudi::IAuditor
The IAuditor is the interface implemented by the Auditor base class.
Definition
IAuditor.h:26
GaudiException
Define general base for Gaudi exception.
Definition
GaudiException.h:29
GaudiException::code
virtual const StatusCode & code() const
StatusCode for Exception.
Definition
GaudiException.h:84
GaudiException::tag
virtual const std::string & tag() const
name tag for the exception, or exception type
Definition
GaudiException.h:75
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition
MsgStream.h:29
StatusCode
This class is used for returning status codes from appropriate routines.
Definition
StatusCode.h:64
MSG::FATAL
@ FATAL
Definition
IMessageSvc.h:22
MSG::ERROR
@ ERROR
Definition
IMessageSvc.h:22
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition
System.cpp:260
GaudiKernel
src
Lib
Guards.cpp
Generated on Thu Oct 2 2025 15:31:11 for The Gaudi Framework by
1.13.1