CLHEP VERSION Reference Documentation
CLHEP Home Page
CLHEP Documentation
CLHEP Bug Reports
Exceptions
src
ZMthrow.cc
Go to the documentation of this file.
1
// ----------------------------------------------------------------------
2
//
3
// ZMthrow.cc -- implementation of ZMthrow
4
//
5
// ZMthrow_() is invoked by the ZMthrow(x) macro, which supplies the lineNum
6
// and file arguments as well as the constructed ZOOM exception object.
7
//
8
// Revision History:
9
// 970910 MF Initial version
10
// 970916 WEB Updated per code review
11
// 970917 WEB Updated per code review 2
12
// 980615 WEB Added namespace support
13
//
14
// ----------------------------------------------------------------------
15
16
17
#include "
CLHEP/Exceptions/ZMthrow.h
"
18
#include "
CLHEP/Exceptions/ZMexSeverity.h
"
19
#include "
CLHEP/Exceptions/ZMexception.h
"
20
#include "
CLHEP/Exceptions/ZMerrno.h
"
21
22
23
namespace
zmex
{
24
25
26
27
//**********************
28
//
29
// ZMthrow_ ()
30
//
31
//**********************
32
33
ZMexAction
ZMthrow_
(
34
const
ZMexception
& userException
35
,
int
lineNum
36
,
const
char
fileName[]
37
) {
38
39
// a) Place the lineNum and fileName information into the exception object.
40
41
// b) Cause the handler to be invoked via x.X::handleMe().
42
// That finds the handler, puts the handler name into the exception,
43
// and invokes the handler's takeCareOf() method, passing it the
44
// exception object so that, if any parent handlers are involved,
45
// you later have x.Y::handleMe() invoked, where Y is an ancestor of X.
46
47
// c) If the exception is of severity ZMexERROR or higher, copy the
48
// exception object onto ZMerrno.
49
50
// d) Return the result of the handler's decision.
51
52
// The following are done elsewhere, so ZMthrow_ does not have to:
53
// The constructor for ZMexception takes care of incrementing
54
// the static count, and saving its value.
55
// The handler notifies the exception object of the handler's
56
// decision whether to have the object be thrown or ignored.
57
// Identifying the logger to call, and saving that information,
58
// in this exception instance, is done by x.logMe()
59
// called by handler, assuming the handler decides to log.
60
61
userException.
location
( lineNum, fileName );
// (a)
62
63
ZMexAction
whatToDo = userException.
handleMe
();
// (b)
64
65
if
( userException.
severity
() >=
ZMexERROR
)
// (c)
66
ZMerrno
.
write
( userException );
67
68
return
whatToDo;
// (d)
69
70
}
// ZMthrow_()
71
72
}
// namespace zmex
ZMexSeverity.h
zmex
Definition:
CLHEP/Exceptions/ZMerrno.h:52
ZMthrow.h
zmex::ZMexception::handleMe
virtual ZMexAction handleMe() const
Definition:
CLHEP/Exceptions/ZMexception.h:447
zmex::ZMerrno
ZMerrnoList ZMerrno
Definition:
Exceptions/ZMerrno.h:122
zmex::ZMexAction
ZMexAction
Definition:
CLHEP/Exceptions/ZMexAction.h:20
zmex::ZMexception
Definition:
CLHEP/Exceptions/ZMexception.h:163
ZMerrno.h
zmex::ZMthrow_
ZMexAction ZMthrow_(const ZMexception &userException, int lineNum, const char fileName[])
Definition:
ZMthrow.cc:33
zmex::ZMexception::location
void location(int line, const std::string file) const
ZMexception.h
zmex::ZMexERROR
@ ZMexERROR
Definition:
CLHEP/Exceptions/ZMexSeverity.h:46
zmex::ZMexception::severity
ZMexSeverity severity() const
zmex::ZMerrnoList::write
void write(const ZMexception &x)
Definition:
ZMerrno.cc:66
Generated by
1.8.17