The Gaudi Framework  v33r0 (d5ea422b)
Guards.cpp
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 // ============================================================================
12 // Include files
13 // ============================================================================
14 // STD & STL
15 // ============================================================================
16 #include <exception>
17 // ============================================================================
18 // GaudiKernel
19 // ============================================================================
21 #include "GaudiKernel/Guards.h"
22 #include "GaudiKernel/MsgStream.h"
23 #include "GaudiKernel/System.h"
24 // ============================================================================
31 // ============================================================================
32 // Local handle (print) of GaudiException
33 // ============================================================================
35  // the general printout
36  log << MSG::FATAL << System::typeinfoName( typeid( exc ) ) << "('" << exc.tag() << "') is caught!" << endmsg;
37  // print the detailes about the exception:
38  log << MSG::ERROR << exc << endmsg;
39  // get the status code form the exception:
40  m_sc = exc.code();
41 }
42 // ============================================================================
43 // Local handle (print) of std::exception
44 // ============================================================================
46  // the general printout
47  log << MSG::FATAL << System::typeinfoName( typeid( exc ) ) << " is caught!" << endmsg;
48  // print the detailes abotu the exception:
49  log << MSG::ERROR << exc.what() << endmsg;
50 }
51 // ============================================================================
52 // Local handle (print) of unknown exception
53 // ============================================================================
55  // the general printout
56  log << MSG::FATAL << "UNKNOWN exception is caught!" << endmsg;
57 }
58 // ============================================================================
59 // dectructor
60 // ============================================================================
62 // ============================================================================
63 // constructor with standard post-action
64 // ============================================================================
66  : m_obj( obj ), m_svc( svc ), m_evt( evt ) {
67  i_before();
68 }
70  : m_obj( obj )
71  , m_svc( svc )
72  , m_evt( IAuditor::Initialize )
73  , // Windows needs an explicit value
74  m_cevt( std::move( evt ) )
75  , m_customEvtType( true ) {
76  i_before();
77 }
79  const StatusCode& sc )
80  : m_obj( obj ), m_svc( svc ), m_evt( evt ), m_sc( &sc ), m_customEvtType( false ) {
81  i_before();
82 }
84  const StatusCode& sc )
85  : m_obj( obj )
86  , m_svc( svc )
87  , m_evt( IAuditor::Initialize )
88  , // Windows needs an explicit value
89  m_cevt( std::move( evt ) )
90  , m_sc( &sc )
91  , m_customEvtType( true ) {
92  i_before();
93 }
95  : m_objName( std::move( name ) ), m_svc( svc ), m_evt( evt ), m_customEvtType( false ) {
96  i_before();
97 }
99  : m_objName( std::move( name ) )
100  , m_svc( svc )
101  , m_evt( IAuditor::Initialize )
102  , // Windows needs an explicit value
103  m_cevt( std::move( evt ) )
104  , m_customEvtType( true ) {
105  i_before();
106 }
108  const StatusCode& sc )
109  : m_objName( std::move( name ) ), m_svc( svc ), m_evt( evt ), m_sc( &sc ), m_customEvtType( false ) {
110  i_before();
111 }
113  const StatusCode& sc )
114  : m_objName( std::move( name ) )
115  , m_svc( svc )
116  , m_evt( IAuditor::Initialize )
117  , // Windows needs an explicit value
118  m_cevt( std::move( evt ) )
119  , m_sc( &sc )
120  , m_customEvtType( true ) {
121  i_before();
122 }
123 // ============================================================================
124 // destructor
125 // ============================================================================
127 // ============================================================================
129 // ============================================================================
void handle(const GaudiException &e, MsgStream &s)
local handler of GaudiException
Definition: Guards.cpp:34
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:34
Define general base for Gaudi exception.
StandardEventType
Defines the standard (= used by the framework) auditable event types.
Definition: IAuditor.h:34
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:308
virtual const std::string & tag() const
name tag for the exception, or exception type
STL namespace.
StatusCode m_sc
status code : result of function evaluation
Definition: Guards.h:168
STL class.
T what(T... args)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
STL class.
virtual const StatusCode & code() const
StatusCode for Exception.
IInterface compliant class extending IInterface with the name() method.
The IAuditor is the interface implmented by the AlgAuditor base class.
Definition: IAuditor.h:28
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:202