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

CLHEP/Exceptions/ZMexHandler.h
Go to the documentation of this file.
1 #ifndef ZMEXHANDLER_H
2 #define ZMEXHANDLER_H
3 
4 
5 // ----------------------------------------------------------------------
6 //
7 // ZMexHandler.h - interface class declarations for the ZOOM Exception
8 // Handler base class and the basic handlers:
9 // ZMexThrowAlways
10 // ZMexIgnoreAlways
11 // ZMexThrowErrors
12 // ZMexIgnoreNextN
13 // ZMexHandleViaParent
14 // These can be used as examples if custom handlers are desired.
15 //
16 // Revision History:
17 // 970909 MF Initial version
18 // 970916 WEB Updated per code review
19 // 970917 WEB Updated per code review 2
20 // 970923 WEB Updated per code review 4
21 // 971008 WEB ZMutility is the new name for the Utility package
22 // 971112 WEB Updated for conformance to standard and the zoom
23 // compatability headers
24 // 980615 WEB Added namespace support
25 // 990318 MF Modified intializer list orders to avoid warnings
26 // 000217 WEB Improve C++ standards compliance
27 // 000503 WEB Avoid global using
28 // 031105 LG Get rid of all ZMutility references
29 //
30 // ----------------------------------------------------------------------
31 
32 #ifndef STRING_INCLUDED
33  #define STRING_INCLUDED
34  #include <string>
35 #endif
36 
37 #ifndef ZMHANDLETO_H
38  #include "CLHEP/RefCount/ZMhandleTo.h"
39 #endif
40 
41 #ifndef ZMEXSEVERITY_H
43 #endif
44 
45 #ifndef ZMEXACTION_H
47 #endif
48 
49 
50 namespace zmex {
51 
52 
53 class ZMexception;
54 
55 
56 //********************
57 //
58 // ZMexHandlerBehavior
59 //
60 //********************
61 
63  // Handler behavior interface definition
64 
65 public:
67  const std::string aname = "ZMexHandlerBehavior"
68  ) : name_( aname ) { }
69 
70  virtual ~ZMexHandlerBehavior() { }
71 
72  virtual ZMexHandlerBehavior * clone() const {
73  return new ZMexHandlerBehavior( *this );
74  }
75 
76  virtual std::string name() const { return name_; }
77  virtual ZMexAction takeCareOf( const ZMexception & ) { return ZMexThrowIt; }
78 
79 protected:
80  /*virtual void handleLog( ZMexception & x, const int limit );*/
81  ZMexAction standardHandling( const ZMexception & x, bool willThrow );
82 
83 private:
84  const std::string name_;
85 
86 }; // ZMexHandlerBehavior
87 
88 
89 
90 //************
91 //
92 // ZMexHandler
93 //
94 //************
95 
96 class ZMexHandler : public ZMhandleTo< ZMexHandlerBehavior > {
97  // Handler interface
98 
99 public:
101  const ZMexHandlerBehavior & behaviorWanted
102  ) :
103  ZMhandleTo<ZMexHandlerBehavior>( behaviorWanted )
104  { }
105 
106  virtual ~ZMexHandler() { }
107 
108  std::string name() const {
109  return rep_->name();
110  }
111 
112  virtual ZMexAction takeCareOf( const ZMexception & x ) {
113  return rep_->takeCareOf(x);
114  }
115 
116  int setLogLimit( ZMexSeverity s, int limit ) {
117  int lim = ZMexSeverityLimit[ s ];
118  ZMexSeverityLimit[ s ] = limit;
119  return lim;
120  }
121 
122 }; // ZMexHandler
123 
124 
125 
126 //****************
127 //
128 // ZMexThrowAlways
129 //
130 //****************
131 
133 
134 public:
135  ZMexThrowAlways() : ZMexHandlerBehavior( "ZMexThrowAlways" ) { }
136  virtual ZMexThrowAlways * clone() const;
137  virtual ZMexAction takeCareOf( const ZMexception & x );
138 };
139 
140 
141 //****************
142 //
143 // ZMexThrowErrors
144 //
145 //****************
146 
148 
149 public:
150  ZMexThrowErrors() : ZMexHandlerBehavior( "ZMexThrowErrors" ) { }
151  virtual ZMexThrowErrors * clone() const;
152  virtual ZMexAction takeCareOf( const ZMexception & x );
153 };
154 
155 
156 //*****************
157 //
158 // ZMexIgnoreAlways
159 //
160 //*****************
161 
163 
164 public:
165  ZMexIgnoreAlways() : ZMexHandlerBehavior( "ZMexIgnoreAlways" ) { }
166  virtual ZMexIgnoreAlways * clone() const;
167  virtual ZMexAction takeCareOf( const ZMexception & x );
168 };
169 
170 
171 //*****************
172 //
173 // ZMexIgnoreNextN
174 //
175 //*****************
176 
178 
179 public:
181  ZMexHandlerBehavior( "ZMexIgnoreNextN" ),
182  countDown_( n )
183  { }
184  virtual ZMexIgnoreNextN * clone() const;
185  virtual ZMexAction takeCareOf( const ZMexception & x );
186 
187 private:
188  int countDown_;
189 };
190 
191 
192 //******************
193 //
194 // ZMexHandleViaParent
195 //
196 //******************
197 
199 public:
201  virtual ZMexHandleViaParent * clone() const;
202  virtual ZMexAction takeCareOf( const ZMexception & x );
203 };
204 
205 
206 } // namespace zmex
207 
208 
209 #define ZMEXHANDLER_ICC
210 #include "CLHEP/Exceptions/ZMexHandler.icc"
211 #undef ZMEXHANDLER_ICC
212 
213 
214 #endif // ZMEXHANDLER_H
ZMexSeverity.h
zmex
Definition: CLHEP/Exceptions/ZMerrno.h:52
zmex::ZMexThrowAlways::ZMexThrowAlways
ZMexThrowAlways()
Definition: CLHEP/Exceptions/ZMexHandler.h:135
zmex::ZMexHandler::~ZMexHandler
virtual ~ZMexHandler()
Definition: CLHEP/Exceptions/ZMexHandler.h:106
zmex::ZMexThrowAlways
Definition: CLHEP/Exceptions/ZMexHandler.h:132
zmex::ZMexHandleViaParent::clone
virtual ZMexHandleViaParent * clone() const
zmex::ZMexIgnoreNextN::ZMexIgnoreNextN
ZMexIgnoreNextN(int n)
Definition: CLHEP/Exceptions/ZMexHandler.h:180
zmex::ZMexIgnoreAlways::ZMexIgnoreAlways
ZMexIgnoreAlways()
Definition: CLHEP/Exceptions/ZMexHandler.h:165
zmex::ZMexIgnoreNextN::takeCareOf
virtual ZMexAction takeCareOf(const ZMexception &x)
zmex::ZMexHandlerBehavior
Definition: CLHEP/Exceptions/ZMexHandler.h:62
zmex::ZMexHandleViaParent::ZMexHandleViaParent
ZMexHandleViaParent()
Definition: CLHEP/Exceptions/ZMexHandler.h:200
zmex::ZMexHandlerBehavior::ZMexHandlerBehavior
ZMexHandlerBehavior(const std::string aname="ZMexHandlerBehavior")
Definition: CLHEP/Exceptions/ZMexHandler.h:66
zmex::ZMexIgnoreNextN
Definition: CLHEP/Exceptions/ZMexHandler.h:177
zmex::ZMexAction
ZMexAction
Definition: CLHEP/Exceptions/ZMexAction.h:20
zmex::ZMexHandler
Definition: CLHEP/Exceptions/ZMexHandler.h:96
zmex::ZMexThrowErrors::clone
virtual ZMexThrowErrors * clone() const
zmex::ZMexThrowIt
@ ZMexThrowIt
Definition: CLHEP/Exceptions/ZMexAction.h:20
zmex::ZMexception
Definition: CLHEP/Exceptions/ZMexception.h:163
zmex::ZMexThrowAlways::takeCareOf
virtual ZMexAction takeCareOf(const ZMexception &x)
zmex::ZMexHandler::setLogLimit
int setLogLimit(ZMexSeverity s, int limit)
Definition: CLHEP/Exceptions/ZMexHandler.h:116
CLHEP::detail::n
n
Definition: Ranlux64Engine.cc:85
zmex::ZMexHandlerBehavior::standardHandling
ZMexAction standardHandling(const ZMexception &x, bool willThrow)
Definition: ZMexHandler.cc:40
ZMhandleTo< ZMexHandlerBehavior >::rep_
ZMexHandlerBehavior * rep_
Definition: Exceptions/CLHEP/RefCount/ZMhandleTo.h:39
ZMhandleTo
Definition: Exceptions/CLHEP/RefCount/ZMhandleTo.h:24
zmex::ZMexHandleViaParent::takeCareOf
virtual ZMexAction takeCareOf(const ZMexception &x)
zmex::ZMexSeverity
ZMexSeverity
Definition: CLHEP/Exceptions/ZMexSeverity.h:32
zmex::ZMexHandlerBehavior::~ZMexHandlerBehavior
virtual ~ZMexHandlerBehavior()
Definition: CLHEP/Exceptions/ZMexHandler.h:70
zmex::ZMexIgnoreAlways
Definition: CLHEP/Exceptions/ZMexHandler.h:162
zmex::ZMexThrowErrors::takeCareOf
virtual ZMexAction takeCareOf(const ZMexception &x)
Definition: ZMexHandler.cc:64
zmex::ZMexHandler::ZMexHandler
ZMexHandler(const ZMexHandlerBehavior &behaviorWanted)
Definition: CLHEP/Exceptions/ZMexHandler.h:100
zmex::ZMexSeverityLimit
int ZMexSeverityLimit[ZMexSEVERITYenumLAST]
Definition: Exceptions/ZMexSeverity.h:78
zmex::ZMexHandler::takeCareOf
virtual ZMexAction takeCareOf(const ZMexception &x)
Definition: CLHEP/Exceptions/ZMexHandler.h:112
zmex::ZMexThrowAlways::clone
virtual ZMexThrowAlways * clone() const
zmex::ZMexThrowErrors
Definition: CLHEP/Exceptions/ZMexHandler.h:147
s
Methods applicble to containers of as in std::list< LorentzVector > s
Definition: keyMergeIssues.doc:328
zmex::ZMexHandlerBehavior::takeCareOf
virtual ZMexAction takeCareOf(const ZMexception &)
Definition: CLHEP/Exceptions/ZMexHandler.h:77
zmex::ZMexHandleViaParent
Definition: CLHEP/Exceptions/ZMexHandler.h:198
zmex::ZMexThrowErrors::ZMexThrowErrors
ZMexThrowErrors()
Definition: CLHEP/Exceptions/ZMexHandler.h:150
zmex::ZMexHandler::name
std::string name() const
Definition: CLHEP/Exceptions/ZMexHandler.h:108
zmex::ZMexHandlerBehavior::clone
virtual ZMexHandlerBehavior * clone() const
Definition: CLHEP/Exceptions/ZMexHandler.h:72
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::ZMexIgnoreAlways::clone
virtual ZMexIgnoreAlways * clone() const
ZMexAction.h
zmex::ZMexIgnoreAlways::takeCareOf
virtual ZMexAction takeCareOf(const ZMexception &x)
zmex::ZMexIgnoreNextN::clone
virtual ZMexIgnoreNextN * clone() const