CLHEP  2.4.7.2
C++ Class Library for High Energy Physics
ZMexHandler.icc
Go to the documentation of this file.
1 #ifndef ZMEXHANDLER_ICC
2 #error "Exceptions/ZMexHandler.icc included without Exceptions/ZMexHandler.h"
3 #endif
4 
5 
6 // ----------------------------------------------------------------------
7 //
8 // ZMexHandler.icc -- inline implementations for the standard handlers.
9 //
10 //
11 // The following methods are defined here:
12 // takeCareOf() and clone() for each provided handler:
13 // ZMexThrowAlways ::takeCareOf() and ::clone()
14 // ZMexIgnoreAlways ::takeCareOf() and ::clone()
15 // ZMexIgnoreNextN ::takeCareOf() and ::clone()
16 // ZMexThrowErrors and ::clone()
17 // ZMexParentHandler::takeCareOf() and ::clone()
18 //
19 // Other implementations are in ZMexHandler.cc
20 //
21 // Revision History:
22 // 970910 MF Initial version
23 // 970917 WEB Updated per code review 2
24 // 980617 WEB Added namespace support
25 //
26 // ----------------------------------------------------------------------
27 
28 
29 namespace zmex {
30 
31 
32 //*******************************************
33 //
34 // takeCareOf() for various standard exceptions
35 //
36 // This operator provides the handler's functionality; in general, it must:
37 // record the handler's name
38 // obtain (via x.OKtoLog() ) permission, from the exception, to log;
39 // if granted, invoke the exception's logger (via x.logMe() )
40 // decide on an action
41 // record (via x.wasThrown() ) the determined action
42 // return the determined action
43 //
44 //*******************************************
45 
46 
47 
48 //******************************
49 //
50 // ZMexThrowAlways::takeCareOf()
51 //
52 //******************************
53 
54 inline ZMexAction ZMexThrowAlways::takeCareOf( const ZMexception & x ) {
55  //DEBUG cerr << "ThrowAlways::takeCareOf" << endl;
56  return standardHandling( x, true );
57 }
58 
59 
60 //*******************************
61 //
62 // ZMexIgnoreAlways::takeCareOf()
63 //
64 //*******************************
65 
66 inline ZMexAction ZMexIgnoreAlways::takeCareOf( const ZMexception & x ) {
67  //DEBUG cerr << "IgnoreAlways::takeCareOf" << endl;
68  return standardHandling( x, false );
69 }
70 
71 
72 
73 //******************************
74 //
75 // ZMexIgnoreNextN::takeCareOf()
76 //
77 //******************************
78 
79 inline ZMexAction ZMexIgnoreNextN::takeCareOf( const ZMexception & x ) {
80 
81  return standardHandling( x, ( countDown_ <= 0 ) ? true
82  : (--countDown_, false)
83  );
84 }
85 
86 
87 //********************************
88 //
89 // ZMexParentHandler::takeCareOf()
90 //
91 //********************************
92 
93 inline ZMexAction ZMexHandleViaParent::takeCareOf( const ZMexception & ) {
94  //DEBUG cerr << "HandleViaParent::takeCareOf" << endl;
95  return ZMexHANDLEVIAPARENT;
96 }
97 
98 
99 //*******************************************
100 //
101 // clone() for various standard exceptions
102 //
103 //*******************************************
104 
105 
106 
107 //*************************
108 //
109 // ZMexThrowAlways::clone()
110 //
111 //*************************
112 
113 inline ZMexThrowAlways * ZMexThrowAlways::clone() const {
114 
115  return new ZMexThrowAlways( *this );
116 }
117 
118 
119 //**************************
120 //
121 // ZMexIgnoreAlways::clone()
122 //
123 //**************************
124 
125 inline ZMexIgnoreAlways * ZMexIgnoreAlways::clone() const {
126 
127  return new ZMexIgnoreAlways( *this );
128 }
129 
130 
131 
132 //**************************
133 //
134 // ZMexThrowErrors::clone()
135 //
136 //**************************
137 
138 inline ZMexThrowErrors * ZMexThrowErrors::clone() const {
139 
140  return new ZMexThrowErrors( *this );
141 }
142 
143 
144 //*************************
145 //
146 // ZMexIgnoreNextN::clone()
147 //
148 //*************************
149 
150 inline ZMexIgnoreNextN * ZMexIgnoreNextN::clone() const {
151 
152  return new ZMexIgnoreNextN( *this );
153 }
154 
155 
156 //***************************
157 //
158 // ZMexParentHandler::clone()
159 //
160 //***************************
161 
162 inline ZMexHandleViaParent * ZMexHandleViaParent::clone() const {
163 
164  return new ZMexHandleViaParent( *this );
165 }
166 
167 
168 } // namespace zmex
Definition: ZMerrno.icc:27