| The Gaudi Framework v29r1 (5cd95fa2)

- 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/GaudiException.h"
11 #include "GaudiKernel/Guards.h"
12 #include "GaudiKernel/MsgStream.h"
13 #include "GaudiKernel/System.h"
14 // ============================================================================
21 // ============================================================================
22 // Local handle (print) of GaudiException
23 // ============================================================================
24 void Gaudi::Guards::ExceptionGuard::handle( const GaudiException& exc, MsgStream& log )
25 {
26 // the general printout
27 log << MSG::FATAL << System::typeinfoName( typeid( exc ) ) << "('" << exc.tag() << "') is caught!" << endmsg;
28 // print the detailes about the exception:
29 log << MSG::ERROR << exc << endmsg;
30 // get the status code form the exception:
31 m_sc = exc.code();
32 }
33 // ============================================================================
34 // Local handle (print) of std::exception
35 // ============================================================================
36 void Gaudi::Guards::ExceptionGuard::handle( const std::exception& exc, MsgStream& log )
37 {
38 // the general printout
39 log << MSG::FATAL << System::typeinfoName( typeid( exc ) ) << " is caught!" << endmsg;
40 // print the detailes abotu the exception:
41 log << MSG::ERROR << exc.what() << endmsg;
42 }
43 // ============================================================================
44 // Local handle (print) of unknown exception
45 // ============================================================================
46 void Gaudi::Guards::ExceptionGuard::handle( MsgStream& log )
47 {
48 // the general printout
49 log << MSG::FATAL << "UNKNOWN exception is caught!" << endmsg;
50 }
51 // ============================================================================
52 // dectructor
53 // ============================================================================
54 Gaudi::Guards::ExceptionGuard::~ExceptionGuard() { m_sc.ignore(); }
55 // ============================================================================
56 // constructor with standard post-action
57 // ============================================================================
58 Gaudi::Guards::AuditorGuard::AuditorGuard( INamedInterface* obj, IAuditor* svc, IAuditor::StandardEventType evt )
59 : m_obj( obj ), m_svc( svc ), m_evt( evt )
60 {
61 i_before();
62 }
63 Gaudi::Guards::AuditorGuard::AuditorGuard( INamedInterface* obj, IAuditor* svc, IAuditor::CustomEventTypeRef evt )
64 : m_obj( obj )
65 , m_svc( svc )
66 , m_evt( IAuditor::Initialize )
67 , // Windows needs an explicit value
68 m_cevt( std::move( evt ) )
69 , m_customEvtType( true )
70 {
71 i_before();
72 }
73 Gaudi::Guards::AuditorGuard::AuditorGuard( INamedInterface* obj, IAuditor* svc, IAuditor::StandardEventType evt,
74 const StatusCode& sc )
75 : m_obj( obj ), m_svc( svc ), m_evt( evt ), m_sc( &sc ), m_customEvtType( false )
76 {
77 i_before();
78 }
79 Gaudi::Guards::AuditorGuard::AuditorGuard( INamedInterface* obj, IAuditor* svc, IAuditor::CustomEventTypeRef evt,
80 const StatusCode& sc )
81 : m_obj( obj )
82 , m_svc( svc )
83 , m_evt( IAuditor::Initialize )
84 , // Windows needs an explicit value
85 m_cevt( std::move( evt ) )
86 , m_sc( &sc )
87 , m_customEvtType( true )
88 {
89 i_before();
90 }
91 Gaudi::Guards::AuditorGuard::AuditorGuard( std::string name, IAuditor* svc, IAuditor::StandardEventType evt )
92 : m_objName( std::move( name ) ), m_svc( svc ), m_evt( evt ), m_customEvtType( false )
93 {
94 i_before();
95 }
96 Gaudi::Guards::AuditorGuard::AuditorGuard( std::string name, IAuditor* svc, IAuditor::CustomEventTypeRef evt )
97 : m_objName( std::move( name ) )
98 , m_svc( svc )
99 , m_evt( IAuditor::Initialize )
100 , // Windows needs an explicit value
101 m_cevt( std::move( evt ) )
102 , m_customEvtType( true )
103 {
104 i_before();
105 }
106 Gaudi::Guards::AuditorGuard::AuditorGuard( std::string name, IAuditor* svc, IAuditor::StandardEventType evt,
107 const StatusCode& sc )
108 : m_objName( std::move( name ) ), m_svc( svc ), m_evt( evt ), m_sc( &sc ), m_customEvtType( false )
109 {
110 i_before();
111 }
112 Gaudi::Guards::AuditorGuard::AuditorGuard( std::string name, IAuditor* svc, IAuditor::CustomEventTypeRef evt,
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 {
122 i_before();
123 }
124 // ============================================================================
125 // destructor
126 // ============================================================================
127 Gaudi::Guards::AuditorGuard::~AuditorGuard() { i_after(); }
128 // ============================================================================
130 // ============================================================================
System.h
Gaudi::Guards::ExceptionGuard::handle
void handle(const GaudiException &e, MsgStream &s)
local handler of GaudiException
Definition: Guards.cpp:24
MsgStream
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
Gaudi::Guards::AuditorGuard::m_evt
IAuditor::StandardEventType m_evt
Event type (standard events)
Definition: Guards.h:258
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:22
Gaudi::Guards::AuditorGuard::i_after
void i_after()
Definition: Guards.h:287
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:32
Gaudi::Guards::AuditorGuard::m_svc
SmartIF< IAuditor > m_svc
auditor service
Definition: Guards.h:256
IAuditor::StandardEventType
StandardEventType
Defines the standard (= used by the framework) auditable event types.
Definition: IAuditor.h:25
MsgStream.h
Gaudi::Guards::AuditorGuard::m_cevt
IAuditor::CustomEventType m_cevt
Event type (custom events)
Definition: Guards.h:260
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:329
std
STL namespace.
Gaudi::Guards::ExceptionGuard::~ExceptionGuard
~ExceptionGuard()
destructor
Definition: Guards.cpp:54
Gaudi::Guards::ExceptionGuard::m_sc
StatusCode m_sc
status code : result of function evaluation
Definition: Guards.h:170
GaudiException::code
virtual const StatusCode & code() const
StatusCode for Exception.
Definition: GaudiException.h:119
std::string
STL class.
MSG::FATAL
Definition: IMessageSvc.h:16
Gaudi::Guards::AuditorGuard::m_obj
INamedInterface * m_obj
the guarded object
Definition: Guards.h:252
std::exception::what
T what(T...args)
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
GaudiException.h
Guards.h
GaudiException::tag
virtual const std::string & tag() const
name tag for the exception, or exception type
Definition: GaudiException.h:109
std::exception
STL class.
Gaudi::Guards::AuditorGuard::m_objName
std::string m_objName
the guarded object name (if there is no INamedInterface)
Definition: Guards.h:254
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:268
Gaudi::Guards::AuditorGuard::~AuditorGuard
~AuditorGuard()
dectructor
Definition: Guards.cpp:127
MSG::ERROR
Definition: IMessageSvc.h:16
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:109
Gaudi::Guards::AuditorGuard::m_sc
const StatusCode * m_sc
Pointer to a status code instance, to be passed to the "after" function if needed The instance must h...
Definition: Guards.h:264
IAuditor
The IAuditor is the interface implmented by the AlgAuditor base class.
Definition: IAuditor.h:18
Gaudi::Guards::AuditorGuard::m_customEvtType
bool m_customEvtType
Flag to remember which event type was used.
Definition: Guards.h:266
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
IOTest.evt
evt
Definition: IOTest.py:96
Gaudi.Configuration.log
log
Definition: Configuration.py:13