Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:03:24

0001 #ifndef ZMEXCLASSINFO_H
0002 #define ZMEXCLASSINFO_H
0003 
0004 
0005 // ----------------------------------------------------------------------
0006 //
0007 // ZMexClassInfo.h - class declaration for the member of ZOOM Exception
0008 //           classes that contains all the static information
0009 //           that does NOT depend on the parent class.
0010 //
0011 //  Every ZOOM exception must have a static member classInfo, of type
0012 //  ZMexClassInfo.  This is done in the macro ZMexStandardContents.
0013 //  See ZMexception.h.
0014 //
0015 //  Methods (in .icc):
0016 //      ZMexClassInfo() constructor
0017 //          const string name() const;
0018 //          const string facility() const;
0019 //          int nextCount();
0020 //          ZMexHandler getHandler() const;
0021 //          ZMexHandler setHandler(const ZMexHandler & newHandler);
0022 //      ZMexLogger getLogger() const;
0023 //          ZMexLogger setLogger(const ZMexLogger & newLogger);
0024 //      void logNMore();
0025 //              bool OKtoLog() const;
0026 //      int count() const;
0027 //      int filterMax() const;
0028 //
0029 //  A related header is ZMexHeritage.h which contains class static info
0030 //  which DOES depend on the parent class.
0031 //
0032 // Revision History
0033 //  970911  MF  Initial version
0034 //  970914  MF  Added nextCount to be able to keep count_ private
0035 //  970916  WEB Updated per code review
0036 //  970917  WEB Updated per code review 2
0037 //      971112  WEB Updated for conformance to standard and the zoom
0038 //          compatability headers
0039 //  971211  WEB Updated per code walkthrough
0040 //  971217  WEB Added count() and filterMax() member functions
0041 //  980219  WEB Fixed get/set Logger/Handler return type
0042 //  980615  WEB Added namespace support
0043 //      990721  JVR     Added setName, setFacility, and setSeverity functions
0044 //      000217  WEB     Improve C++ standard compliance
0045 //      000503  WEB     Avoid global using
0046 //      010411  MF  setName, setFacility and setSeverity return old value
0047 //          and take const argument reference
0048 //  011212  WEB Pass all std::strings by const &; add new 3- and
0049 //          4-arg constructors in lieu of a single 5-arg
0050 //          constructor taking default arguments
0051 //  031105  LG  Get rid of all ZMutility references
0052 
0053 //
0054 // ----------------------------------------------------------------------
0055 
0056 #ifndef STRING_INCLUDED
0057   #define STRING_INCLUDED
0058   #include <string>
0059 #endif
0060 
0061 #ifndef ZMEXHANDLER_H
0062   #include "CLHEP/Exceptions/ZMexHandler.h"
0063 #endif
0064 
0065 #ifndef ZMEXLOGGER_H
0066   #include "CLHEP/Exceptions/ZMexLogger.h"
0067 #endif
0068 
0069 #ifndef ZMEXSEVERITY_H
0070   #include "CLHEP/Exceptions/ZMexSeverity.h"
0071 #endif
0072 
0073 
0074 namespace zmex  {
0075 
0076 
0077 // ******************************************************
0078 //
0079 // ZMexClassInfo
0080 //
0081 // Template for ZMexClassInfo (used to define classInfo)
0082 //
0083 // ******************************************************
0084 
0085 // Contains all the methods which are logically "virtual class statics",
0086 // and which do not depend on a Parent's method (see note (1)).
0087 // Each derived exception contains a ZMexClassInfo member named classInfo.
0088 
0089 // The members and functions of ZMexClassInfo are public so that when the
0090 // exception class uses classInfo it can get at the info.  But classInfo itself
0091 // is declared protected, to isolate this from the actual interface.
0092 
0093 
0094 class ZMexClassInfo {
0095 
0096   // - Methods - //
0097 
0098 public:
0099 
0100   ZMexClassInfo(
0101     const std::string & name
0102   , const std::string & facility
0103   , const ZMexSeverity  s = ZMexERROR
0104   );
0105 
0106   ZMexClassInfo(
0107     const std::string & name
0108   , const std::string & facility
0109   , const ZMexSeverity  s
0110   , const ZMexHandler & h
0111   );
0112 
0113   ZMexClassInfo(
0114     const std::string & name
0115   , const std::string & facility
0116   , const ZMexSeverity  s
0117   , const ZMexHandler & h
0118   , const ZMexLogger &  l
0119   );
0120 
0121   const std::string name() const;
0122     // return the name_ of this exception type, which ought to match the
0123     // class name ZMexWhatever.
0124   const std::string setName(const std::string& newName);
0125 
0126   const std::string facility() const;
0127     // return the name of facility_ this exception type is under.
0128   const std::string setFacility(const std::string& newFacility);
0129 
0130   ZMexSeverity severity() const;
0131     // return the severity_ of the exception class.
0132   ZMexSeverity setSeverity(const ZMexSeverity& newSeverity);
0133 
0134   int nextCount();
0135     // increment the count_ and return that value
0136   int count() const;
0137     // return the current count_ value
0138 
0139   ZMexHandler getHandler () const ;
0140   ZMexHandler setHandler( const ZMexHandler & newHandler );
0141     // Replace previous handler with this new one.
0142 
0143   ZMexLogger getLogger() const;
0144   ZMexLogger setLogger( const ZMexLogger & newLogger );
0145     // Replace previous logger with this new one.
0146 
0147   void logNMore( const int N );
0148     // Allow logging the next N exceptions of this class.
0149 
0150   bool OKtoLog() const;
0151     // May the currently-thrown exception be logged
0152     // (based on count_ <= filterMax_)?
0153 
0154   int filterMax() const;
0155     // return the current filterMax_ value
0156 
0157   // - Data Members - //
0158 
0159 private:
0160   int           count_;
0161   int           filterMax_;
0162   std::string   name_;                                             // was const
0163   std::string   facility_;                                         // was const
0164   ZMexSeverity  severity_;                                         // was const
0165 
0166   ZMexHandler   handler_;
0167   ZMexLogger    logger_;
0168 
0169 };  // ZMexClassInfo
0170 
0171 
0172 }  // namespace zmex
0173 
0174 
0175 #define ZMEXCLASSINFO_ICC
0176 #include "CLHEP/Exceptions/ZMexClassInfo.icc"
0177 #undef ZMEXCLASSINFO_ICC
0178 
0179 
0180 #endif  // ZMEXCLASSINFO_H