CLHEP VERSION Reference Documentation
CLHEP Home Page
CLHEP Documentation
CLHEP Bug Reports
Main Page
Namespaces
Classes
Files
File List
File Members
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
Generated on Sun Jun 17 2012 08:08:28 for CLHEP by
1.8.1.1