CLHEP 2.0.4.7 Reference Documentation
CLHEP Home Page CLHEP Documentation CLHEP Bug Reports |
00001 #ifndef ZMEXCLASSINFO_H 00002 #define ZMEXCLASSINFO_H 00003 00004 00005 // ---------------------------------------------------------------------- 00006 // 00007 // ZMexClassInfo.h - class declaration for the member of ZOOM Exception 00008 // classes that contains all the static information 00009 // that does NOT depend on the parent class. 00010 // 00011 // Every ZOOM exception must have a static member classInfo, of type 00012 // ZMexClassInfo. This is done in the macro ZMexStandardContents. 00013 // See ZMexception.h. 00014 // 00015 // Methods (in .icc): 00016 // ZMexClassInfo() constructor 00017 // const string name() const; 00018 // const string facility() const; 00019 // int nextCount(); 00020 // ZMexHandler getHandler() const; 00021 // ZMexHandler setHandler(const ZMexHandler & newHandler); 00022 // ZMexLogger getLogger() const; 00023 // ZMexLogger setLogger(const ZMexLogger & newLogger); 00024 // void logNMore(); 00025 // bool OKtoLog() const; 00026 // int count() const; 00027 // int filterMax() const; 00028 // 00029 // A related header is ZMexHeritage.h which contains class static info 00030 // which DOES depend on the parent class. 00031 // 00032 // Revision History 00033 // 970911 MF Initial version 00034 // 970914 MF Added nextCount to be able to keep count_ private 00035 // 970916 WEB Updated per code review 00036 // 970917 WEB Updated per code review 2 00037 // 971112 WEB Updated for conformance to standard and the zoom 00038 // compatability headers 00039 // 971211 WEB Updated per code walkthrough 00040 // 971217 WEB Added count() and filterMax() member functions 00041 // 980219 WEB Fixed get/set Logger/Handler return type 00042 // 980615 WEB Added namespace support 00043 // 990721 JVR Added setName, setFacility, and setSeverity functions 00044 // 000217 WEB Improve C++ standard compliance 00045 // 000503 WEB Avoid global using 00046 // 010411 MF setName, setFacility and setSeverity return old value 00047 // and take const argument reference 00048 // 011212 WEB Pass all std::strings by const &; add new 3- and 00049 // 4-arg constructors in lieu of a single 5-arg 00050 // constructor taking default arguments 00051 // 031105 LG Get rid of all ZMutility references 00052 00053 // 00054 // ---------------------------------------------------------------------- 00055 00056 #ifndef STRING_INCLUDED 00057 #define STRING_INCLUDED 00058 #include <string> 00059 #endif 00060 00061 #ifndef ZMEXHANDLER_H 00062 #include "CLHEP/Exceptions/ZMexHandler.h" 00063 #endif 00064 00065 #ifndef ZMEXLOGGER_H 00066 #include "CLHEP/Exceptions/ZMexLogger.h" 00067 #endif 00068 00069 #ifndef ZMEXSEVERITY_H 00070 #include "CLHEP/Exceptions/ZMexSeverity.h" 00071 #endif 00072 00073 00074 namespace zmex { 00075 00076 00077 // ****************************************************** 00078 // 00079 // ZMexClassInfo 00080 // 00081 // Template for ZMexClassInfo (used to define classInfo) 00082 // 00083 // ****************************************************** 00084 00085 // Contains all the methods which are logically "virtual class statics", 00086 // and which do not depend on a Parent's method (see note (1)). 00087 // Each derived exception contains a ZMexClassInfo member named classInfo. 00088 00089 // The members and functions of ZMexClassInfo are public so that when the 00090 // exception class uses classInfo it can get at the info. But classInfo itself 00091 // is declared protected, to isolate this from the actual interface. 00092 00093 00094 class ZMexClassInfo { 00095 00096 // - Methods - // 00097 00098 public: 00099 00100 ZMexClassInfo( 00101 const std::string & name 00102 , const std::string & facility 00103 , const ZMexSeverity s = ZMexERROR 00104 ); 00105 00106 ZMexClassInfo( 00107 const std::string & name 00108 , const std::string & facility 00109 , const ZMexSeverity s 00110 , const ZMexHandler & h 00111 ); 00112 00113 ZMexClassInfo( 00114 const std::string & name 00115 , const std::string & facility 00116 , const ZMexSeverity s 00117 , const ZMexHandler & h 00118 , const ZMexLogger & l 00119 ); 00120 00121 const std::string name() const; 00122 // return the name_ of this exception type, which ought to match the 00123 // class name ZMexWhatever. 00124 const std::string setName(const std::string& newName); 00125 00126 const std::string facility() const; 00127 // return the name of facility_ this exception type is under. 00128 const std::string setFacility(const std::string& newFacility); 00129 00130 ZMexSeverity severity() const; 00131 // return the severity_ of the exception class. 00132 ZMexSeverity setSeverity(const ZMexSeverity& newSeverity); 00133 00134 int nextCount(); 00135 // increment the count_ and return that value 00136 int count() const; 00137 // return the current count_ value 00138 00139 ZMexHandler getHandler () const ; 00140 ZMexHandler setHandler( const ZMexHandler & newHandler ); 00141 // Replace previous handler with this new one. 00142 00143 ZMexLogger getLogger() const; 00144 ZMexLogger setLogger( const ZMexLogger & newLogger ); 00145 // Replace previous logger with this new one. 00146 00147 void logNMore( const int N ); 00148 // Allow logging the next N exceptions of this class. 00149 00150 bool OKtoLog() const; 00151 // May the currently-thrown exception be logged 00152 // (based on count_ <= filterMax_)? 00153 00154 int filterMax() const; 00155 // return the current filterMax_ value 00156 00157 // - Data Members - // 00158 00159 private: 00160 int count_; 00161 int filterMax_; 00162 std::string name_; // was const 00163 std::string facility_; // was const 00164 ZMexSeverity severity_; // was const 00165 00166 ZMexHandler handler_; 00167 ZMexLogger logger_; 00168 00169 }; // ZMexClassInfo 00170 00171 00172 } // namespace zmex 00173 00174 00175 #define ZMEXCLASSINFO_ICC 00176 #include "CLHEP/Exceptions/ZMexClassInfo.icc" 00177 #undef ZMEXCLASSINFO_ICC 00178 00179 00180 #endif // ZMEXCLASSINFO_H