CLHEP VERSION Reference Documentation
CLHEP Home Page
CLHEP Documentation
CLHEP Bug Reports
Exceptions
src
ZMexHandler.cc
Go to the documentation of this file.
1
// ----------------------------------------------------------------------
2
//
3
// ZMexHandler.cc -- implementations for the standard handlers.
4
//
5
//
6
// The following methods are defined here:
7
// standardHandling( ZMexception & x, bool willThrow )
8
// ZMexThrowErrors::takeCareOf()
9
//
10
// Revision History:
11
// 970923 PhilC Initial version
12
// 971113 WEB Updated to conform to standard coding techniques
13
// 980615 WEB Added namespace support
14
//
15
// ----------------------------------------------------------------------
16
17
18
#include "
CLHEP/Exceptions/ZMexHandler.h
"
19
20
#include "
CLHEP/Exceptions/ZMexception.h
"
21
22
23
namespace
zmex
{
24
25
26
//******************************************
27
//
28
// standardHandling( ZMexception & x, bool willThrow )
29
// provides functionality common to many (most?) handlers:
30
// record the handler's name
31
// record (via x.wasThrown() ) the determined action
32
// obtain permission, from the exception, to log;
33
// if granted, invoke the exception's logger
34
// return the determined action
35
//
36
//******************************************
37
38
ZMexAction
39
ZMexHandlerBehavior::
40
standardHandling
(
const
ZMexception
&
x
,
bool
willThrow ) {
41
42
x
.handlerUsed(
name
() );
// record handler's name
43
x
.wasThrown( willThrow );
// record go/nogo decision
44
45
int
& val =
ZMexSeverityLimit
[
x
.severity() ];
46
47
if
(
x
.OKtoLog() && val != 0 )
// handle logging, if desired
48
if
(
x
.logMe() ==
ZMexLOGGED
&& val > 0 )
49
--val;
50
51
return
willThrow ?
ZMexThrowIt
52
:
ZMexIgnoreIt
;
53
}
54
55
56
//*******************************
57
//
58
// ZMexThrowErrors::takeCareOf()
59
//
60
//*******************************
61
62
ZMexAction
63
ZMexThrowErrors::
64
takeCareOf
(
const
ZMexception
&
x
) {
65
//DEBUG cerr << "ThrowErrors::takeCareOf" << endl;
66
return
standardHandling
(
x
, (
x
.severity() >=
ZMexERROR
) ?
true
67
:
false
68
);
69
}
70
71
72
}
// namespace zmex
zmex
Definition:
CLHEP/Exceptions/ZMerrno.h:52
ZMexHandler.h
zmex::ZMexLOGGED
@ ZMexLOGGED
Definition:
CLHEP/Exceptions/ZMexLogResult.h:19
zmex::ZMexAction
ZMexAction
Definition:
CLHEP/Exceptions/ZMexAction.h:20
zmex::ZMexThrowIt
@ ZMexThrowIt
Definition:
CLHEP/Exceptions/ZMexAction.h:20
zmex::ZMexception
Definition:
CLHEP/Exceptions/ZMexception.h:163
zmex::ZMexHandlerBehavior::standardHandling
ZMexAction standardHandling(const ZMexception &x, bool willThrow)
Definition:
ZMexHandler.cc:40
zmex::ZMexThrowErrors::takeCareOf
virtual ZMexAction takeCareOf(const ZMexception &x)
Definition:
ZMexHandler.cc:64
zmex::ZMexSeverityLimit
int ZMexSeverityLimit[ZMexSEVERITYenumLAST]
Definition:
Exceptions/ZMexSeverity.h:78
ZMexception.h
zmex::ZMexERROR
@ ZMexERROR
Definition:
CLHEP/Exceptions/ZMexSeverity.h:46
x
any side effects of that construction would occur twice The semantics of throw x
Definition:
whyZMthrowRethrows.txt:37
zmex::ZMexHandlerBehavior::name
virtual std::string name() const
Definition:
CLHEP/Exceptions/ZMexHandler.h:76
zmex::ZMexIgnoreIt
@ ZMexIgnoreIt
Definition:
CLHEP/Exceptions/ZMexAction.h:20
Generated by
1.8.17