CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

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
19
21
22
23namespace 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
40standardHandling( 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
53}
54
55
56//*******************************
57//
58// ZMexThrowErrors::takeCareOf()
59//
60//*******************************
61
64takeCareOf( 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
ZMexAction standardHandling(const ZMexception &x, bool willThrow)
Definition: ZMexHandler.cc:40
virtual std::string name() const
virtual ZMexAction takeCareOf(const ZMexception &x)
Definition: ZMexHandler.cc:64
virtual ZMexLogResult logMe() const
std::string handlerUsed() const
bool wasThrown() const
ZMexSeverity severity() const
bool OKtoLog() const
int ZMexSeverityLimit[ZMexSEVERITYenumLAST]