| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

Guards.cpp
Go to the documentation of this file.
1 // ============================================================================
2 // Include files
3 // ============================================================================
4 // STD & STL
5 // ============================================================================
6 #include <exception>
7 // ============================================================================
8 // GaudiKernel
9 // ============================================================================
10 #include "GaudiKernel/Guards.h"
11 #include "GaudiKernel/System.h"
12 #include "GaudiKernel/MsgStream.h"
13 #include "GaudiKernel/GaudiException.h"
14 // ============================================================================
21 // ============================================================================
22 // Local handle (print) of GaudiException
23 // ============================================================================
24 void Gaudi::Guards::ExceptionGuard::handle
25 ( const GaudiException& exc , MsgStream& log )
26 {
27 // the general printout
28 log << MSG::FATAL
29 << System::typeinfoName( typeid ( exc ) )
30 << "('" << exc.tag() << "') is caught!" << endmsg ;
31 // print the detailes about the exception:
32 log << MSG::ERROR << exc << endmsg ;
33 // get the status code form the exception:
34 m_sc = exc.code() ;
35 }
36 // ============================================================================
37 // Local handle (print) of std::exception
38 // ============================================================================
39 void Gaudi::Guards::ExceptionGuard::handle
40 ( const std::exception& exc , MsgStream& log )
41 {
42 // the general printout
43 log << MSG::FATAL
44 << System::typeinfoName( typeid ( exc ) ) << " is caught!" << endmsg ;
45 // print the detailes abotu the exception:
46 log << MSG::ERROR << exc.what() << endmsg ;
47 }
48 // ============================================================================
49 // Local handle (print) of unknown exception
50 // ============================================================================
51 void Gaudi::Guards::ExceptionGuard::handle
52 ( MsgStream& log )
53 {
54 // the general printout
55 log << MSG::FATAL << "UNKNOWN exception is caught!" << endmsg ;
56 }
57 // ============================================================================
58 // dectructor
59 // ============================================================================
60 Gaudi::Guards::ExceptionGuard::~ExceptionGuard() { m_sc.ignore() ; }
61 // ============================================================================
62 // constructor with standard post-action
63 // ============================================================================
64 Gaudi::Guards::AuditorGuard::AuditorGuard ( INamedInterface* obj ,
65 IAuditor* svc ,
66 IAuditor::StandardEventType evt ):
67 m_obj(obj),
68 m_svc(svc),
69 m_evt(evt)
70 {
71 i_before();
72 }
73 Gaudi::Guards::AuditorGuard::AuditorGuard ( INamedInterface* obj ,
74 IAuditor* svc ,
75 IAuditor::CustomEventTypeRef evt ):
76 m_obj(obj),
77 m_svc(svc),
78 m_evt(IAuditor::Initialize), // Windows needs an explicit value
79 m_cevt(std::move(evt)),
80 m_customEvtType(true)
81 {
82 i_before();
83 }
84 Gaudi::Guards::AuditorGuard::AuditorGuard ( INamedInterface* obj ,
85 IAuditor* svc ,
86 IAuditor::StandardEventType evt ,
87 const StatusCode &sc ):
88 m_obj(obj),
89 m_svc(svc),
90 m_evt(evt),
91 m_sc(&sc),
92 m_customEvtType(false)
93 {
94 i_before();
95 }
96 Gaudi::Guards::AuditorGuard::AuditorGuard ( INamedInterface* obj ,
97 IAuditor* svc ,
98 IAuditor::CustomEventTypeRef evt ,
99 const StatusCode &sc ):
100 m_obj(obj),
101 m_svc(svc),
102 m_evt(IAuditor::Initialize), // Windows needs an explicit value
103 m_cevt(std::move(evt)),
104 m_sc(&sc),
105 m_customEvtType(true)
106 {
107 i_before();
108 }
109 Gaudi::Guards::AuditorGuard::AuditorGuard ( std::string name ,
110 IAuditor* svc ,
111 IAuditor::StandardEventType evt ):
112 m_objName(std::move(name)),
113 m_svc(svc),
114 m_evt(evt),
115 m_customEvtType(false)
116 {
117 i_before();
118 }
119 Gaudi::Guards::AuditorGuard::AuditorGuard ( std::string name ,
120 IAuditor* svc ,
121 IAuditor::CustomEventTypeRef evt ):
122 m_objName(std::move(name)),
123 m_svc(svc),
124 m_evt(IAuditor::Initialize), // Windows needs an explicit value
125 m_cevt(std::move(evt)),
126 m_customEvtType(true)
127 {
128 i_before();
129 }
130 Gaudi::Guards::AuditorGuard::AuditorGuard ( std::string name ,
131 IAuditor* svc ,
132 IAuditor::StandardEventType evt ,
133 const StatusCode &sc ):
134 m_objName(std::move(name)),
135 m_svc(svc),
136 m_evt(evt),
137 m_sc(&sc),
138 m_customEvtType(false)
139 {
140 i_before();
141 }
142 Gaudi::Guards::AuditorGuard::AuditorGuard ( std::string name ,
143 IAuditor* svc ,
144 IAuditor::CustomEventTypeRef evt ,
145 const StatusCode &sc ):
146 m_objName(std::move(name)),
147 m_svc(svc),
148 m_evt(IAuditor::Initialize), // Windows needs an explicit value
149 m_cevt(std::move(evt)),
150 m_sc(&sc),
151 m_customEvtType(true)
152 {
153 i_before();
154 }
155 // ============================================================================
156 // destructor
157 // ============================================================================
158 Gaudi::Guards::AuditorGuard::~AuditorGuard()
159 {
160 i_after();
161 }
162 // ============================================================================
164 // ============================================================================
System.h
Gaudi::Guards::ExceptionGuard::handle
void handle(const GaudiException &e, MsgStream &s)
local handler of GaudiException
Definition: Guards.cpp:25
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:23
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:28
IAuditor::StandardEventType
StandardEventType
Defines the standard (= used by the framework) auditable event types.
Definition: IAuditor.h:24
MsgStream.h
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:297
Gaudi.Configuration.log
tuple log
Definition: Configuration.py:13
std
STL namespace.
Gaudi::Guards::ExceptionGuard::~ExceptionGuard
~ExceptionGuard()
destructor
Definition: Guards.cpp:60
merge_files.sc
int sc
Definition: merge_files.py:167
Gaudi::Guards::ExceptionGuard::m_sc
StatusCode m_sc
status code : result of function evaluation
Definition: Guards.h:169
GaudiException::code
virtual const StatusCode & code() const
StatusCode for Exception.
Definition: GaudiException.h:127
std::string
STL class.
MSG::FATAL
Definition: IMessageSvc.h:22
std::exception::what
T what(T...args)
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
GaudiException.h
read_lhcb_event_file.evt
tuple evt
Definition: read_lhcb_event_file.py:14
Guards.h
GaudiException::tag
virtual const std::string & tag() const
name tag for the exception, or exception type
Definition: GaudiException.h:119
std::exception
STL class.
INamedInterface
IInterface compliant class extending IInterface with the name() method.
Definition: INamedInterface.h:15
Gaudi::Guards::AuditorGuard::AuditorGuard
AuditorGuard()=delete
Gaudi::Guards::AuditorGuard::i_before
void i_before()
Definition: Guards.h:284
Gaudi::Guards::AuditorGuard::~AuditorGuard
~AuditorGuard()
dectructor
Definition: Guards.cpp:158
MSG::ERROR
Definition: IMessageSvc.h:21
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:108
IAuditor
The IAuditor is the interface implmented by the AlgAuditor base class.
Definition: IAuditor.h:18
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244