All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Guards.cpp
Go to the documentation of this file.
1 // $Id: Guards.cpp,v 1.4 2008/11/11 14:43:37 marcocle Exp $
2 // ============================================================================
3 // Include files
4 // ============================================================================
5 // STD & STL
6 // ============================================================================
7 #include <exception>
8 // ============================================================================
9 // GaudiKernel
10 // ============================================================================
11 #include "GaudiKernel/Guards.h"
12 #include "GaudiKernel/System.h"
13 #include "GaudiKernel/MsgStream.h"
15 // ============================================================================
22 // ============================================================================
23 // Local handle (print) of GaudiException
24 // ============================================================================
26 ( const GaudiException& exc , MsgStream& log )
27 {
28  // the general printout
29  log << MSG::FATAL
30  << System::typeinfoName( typeid ( exc ) )
31  << "('" << exc.tag() << "') is caught!" << endmsg ;
32  // print the detailes about the exception:
33  log << MSG::ERROR << exc << endmsg ;
34  // get the status code form the exception:
35  m_sc = exc.code() ;
36 }
37 // ============================================================================
38 // Local handle (print) of std::exception
39 // ============================================================================
41 ( const std::exception& exc , MsgStream& log )
42 {
43  // the general printout
44  log << MSG::FATAL
45  << System::typeinfoName( typeid ( exc ) ) << " is caught!" << endmsg ;
46  // print the detailes abotu the exception:
47  log << MSG::ERROR << exc.what() << endmsg ;
48 }
49 // ============================================================================
50 // Local handle (print) of unknown exception
51 // ============================================================================
53 ( MsgStream& log )
54 {
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  IAuditor* svc ,
68  m_obj(obj),
69  m_objName(),
70  m_svc(svc),
71  m_evt(evt),
72  m_cevt(),
73  m_sc(0),
74  m_customEvtType(false)
75 {
76  i_before();
77 }
79  IAuditor* svc ,
81  m_obj(obj),
82  m_objName(),
83  m_svc(svc),
84  m_evt(IAuditor::Initialize), // Windows needs an explicit value
85  m_cevt(evt),
86  m_sc(0),
87  m_customEvtType(true)
88 {
89  i_before();
90 }
92  IAuditor* svc ,
94  const StatusCode &sc ):
95  m_obj(obj),
96  m_objName(),
97  m_svc(svc),
98  m_evt(evt),
99  m_cevt(),
100  m_sc(&sc),
101  m_customEvtType(false)
102 {
103  i_before();
104 }
106  IAuditor* svc ,
108  const StatusCode &sc ):
109  m_obj(obj),
110  m_objName(),
111  m_svc(svc),
112  m_evt(IAuditor::Initialize), // Windows needs an explicit value
113  m_cevt(evt),
114  m_sc(&sc),
115  m_customEvtType(true)
116 {
117  i_before();
118 }
119 Gaudi::Guards::AuditorGuard::AuditorGuard ( const std::string &name ,
120  IAuditor* svc ,
122  m_obj(0),
123  m_objName(name),
124  m_svc(svc),
125  m_evt(evt),
126  m_cevt(),
127  m_sc(0),
128  m_customEvtType(false)
129 {
130  i_before();
131 }
132 Gaudi::Guards::AuditorGuard::AuditorGuard ( const std::string &name ,
133  IAuditor* svc ,
135  m_obj(0),
136  m_objName(name),
137  m_svc(svc),
138  m_evt(IAuditor::Initialize), // Windows needs an explicit value
139  m_cevt(evt),
140  m_sc(0),
141  m_customEvtType(true)
142 {
143  i_before();
144 }
145 Gaudi::Guards::AuditorGuard::AuditorGuard ( const std::string &name ,
146  IAuditor* svc ,
148  const StatusCode &sc ):
149  m_obj(0),
150  m_objName(name),
151  m_svc(svc),
152  m_evt(evt),
153  m_cevt(),
154  m_sc(&sc),
155  m_customEvtType(false)
156 {
157  i_before();
158 }
159 Gaudi::Guards::AuditorGuard::AuditorGuard ( const std::string &name ,
160  IAuditor* svc ,
162  const StatusCode &sc ):
163  m_obj(0),
164  m_objName(name),
165  m_svc(svc),
166  m_evt(IAuditor::Initialize), // Windows needs an explicit value
167  m_cevt(evt),
168  m_sc(&sc),
169  m_customEvtType(true)
170 {
171  i_before();
172 }
173 // ============================================================================
174 // dectructor
175 // ============================================================================
177 {
178  i_after();
179 }
180 // ============================================================================
182 // ============================================================================
void handle(const GaudiException &e, MsgStream &s)
local handler of GaudiException
Definition: Guards.cpp:26
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
Define general base for Gaudi exception.
AuditorGuard()
the default constructor is disabled
StandardEventType
Defines the standard (= used by the framework) auditable event types.
Definition: IAuditor.h:24
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:298
const CustomEventType & CustomEventTypeRef
Used in function calls for optimization purposes.
Definition: IAuditor.h:41
~ExceptionGuard()
destructor
Definition: Guards.cpp:61
StatusCode m_sc
status code : result of function evaluation
Definition: Guards.h:173
virtual const StatusCode & code() const
StatusCode for Exception.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual const std::string & tag() const
name tag for the exception, or exception type
IInterface compliant class extending IInterface with the name() method.
~AuditorGuard()
dectructor
Definition: Guards.cpp:176
void ignore() const
Definition: StatusCode.h:94
The IAuditor is the interface implmented by the AlgAuditor base class.
Definition: IAuditor.h:18
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:243