CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/FWCore/MessageLogger/interface/ELseverityLevel.h

Go to the documentation of this file.
00001 #ifndef MessageLogger_ELseverityLevel_h
00002 #define MessageLogger_ELseverityLevel_h
00003 
00004 
00005 // ----------------------------------------------------------------------
00006 //
00007 // ELseverityLevel.h - declare objects that encode a message's urgency
00008 //
00009 //      Both frameworker and user will often pass one of the
00010 //      instantiated severity levels to logger methods.
00011 //
00012 //      The only other methods of ELseverityLevel a frameworker
00013 //      might use is to check the relative level of two severities
00014 //      using operator< or the like.
00015 //
00016 // 30-Jun-1998 mf       Created file.
00017 // 26-Aug-1998 WEB      Made ELseverityLevel object less weighty.
00018 // 16-Jun-1999 mf       Added constructor from string.
00019 // 23-Jun-1999 mf       Additional ELsev_noValueAssigned to allow constructor
00020 //                      from string to give ELunspecified when not found, while
00021 //                      still allowing finding zero severity.
00022 // 23-Jun-1999 mf       Corrections for subtleties in initialization of
00023 //                      global symbols:
00024 //                              Added ELsevLevGlobals array
00025 //                              Changed extern consts of SLseverityLevels into
00026 //                                const ELseverityLevel & 's
00027 //                              Inserted class ELinitializeGlobalSeverityObjects
00028 //                                in place of the
00029 //                                initializeGlobalSeverityObjects() function.
00030 //                              Changed globalSeverityObjectsGuarantor to an
00031 //                                ELinitializeGlobalSeverityObjects instance.
00032 // 30-Jun-1999 mf       Modifications to eliminate problems with order of
00033 //                      globals initializations:
00034 //                              translate(), getInputStr(), getVarName()
00035 // 12-Jun-2000 web      Final fix to global static initialization problem
00036 // 14-Jun-2000 web      Declare classes before granting friendship.
00037 // 27-Jun-2000 web      Fix order-of-static-destruction problem
00038 //
00039 // ----------------------------------------------------------------------
00040 
00041 
00042 #ifndef ELSTRING_H
00043   #include "FWCore/MessageLogger/interface/ELstring.h"
00044 #endif
00045 
00046 namespace edm {       
00047 
00048 
00049 // ----------------------------------------------------------------------
00050 // Forward declaration:
00051 // ----------------------------------------------------------------------
00052 
00053 class ELseverityLevel;
00054 
00055 
00056 // ----------------------------------------------------------------------
00057 // Synonym for type of ELseverityLevel-generating function:
00058 // ----------------------------------------------------------------------
00059 
00060 typedef  ELseverityLevel const  ELslGen();
00061 
00062 
00063 // ----------------------------------------------------------------------
00064 // ELslProxy class template:
00065 // ----------------------------------------------------------------------
00066 
00067 template< ELslGen ELgen >
00068 struct ELslProxy  {
00069 
00070   // --- birth/death:
00071   //
00072   ELslProxy();
00073   ~ELslProxy();
00074 
00075   // --- copying:
00076   //
00077   ELslProxy( ELslProxy const & );
00078   ELslProxy const &  operator= ( ELslProxy const & );
00079 
00080   // --- conversion::
00081   //
00082   operator ELseverityLevel const () const;
00083 
00084   // --- forwarding:
00085   //
00086   int             getLevel()    const;
00087   const ELstring  getSymbol()   const;
00088   const ELstring  getName()     const;
00089   const ELstring  getInputStr() const;
00090   const ELstring  getVarName()  const;
00091 
00092 };  // ELslProxy<ELslGen>
00093 
00094 // ----------------------------------------------------------------------
00095 
00096 
00097 // ----------------------------------------------------------------------
00098 // ELseverityLevel:
00099 // ----------------------------------------------------------------------
00100 
00101 class ELseverityLevel  {
00102 
00103 public:
00104 
00105   // ---  One ELseverityLevel is globally instantiated (see below)
00106   // ---  for each of the following levels:
00107   //
00108   enum ELsev_  {
00109     ELsev_noValueAssigned = 0  // default returned by map when not found
00110   , ELsev_zeroSeverity         // threshold use only
00111   , ELsev_incidental           // flash this on a screen
00112   , ELsev_success              // report reaching a milestone
00113   , ELsev_info                 // information
00114   , ELsev_warning              // warning
00115   , ELsev_warning2             // more serious warning
00116   , ELsev_error                // error detected
00117   , ELsev_error2               // more serious error
00118   , ELsev_next                 // advise to skip to next event
00119   , ELsev_unspecified          // severity was not specified
00120   , ELsev_severe               // future results are suspect
00121   , ELsev_severe2              // more severe
00122   , ELsev_abort                // suggest aborting
00123   , ELsev_fatal                // strongly suggest aborting!
00124   , ELsev_highestSeverity      // threshold use only
00125   // -----
00126   , nLevels                    // how many levels?
00127   };  // ELsev_
00128 
00129   // -----  Birth/death:
00130   //
00131   ELseverityLevel( ELsev_ lev = ELsev_unspecified );
00132   ELseverityLevel ( ELstring const & str );
00133         // str may match getSymbol, getName, getInputStr,
00134         // or getVarName -- see accessors
00135   ~ELseverityLevel();
00136 
00137   // -----  Comparator:
00138   //
00139   int  cmp( ELseverityLevel const & e ) const;
00140 
00141   // -----  Accessors:
00142   //
00143   int             getLevel()    const;
00144   const ELstring  getSymbol()   const;  // example: "-e"
00145   const ELstring  getName()     const;  // example: "Error"
00146   const ELstring  getInputStr() const;  // example: "ERROR"
00147   const ELstring  getVarName()  const;  // example: "ELerror"
00148 
00149   // -----  Emitter:
00150   //
00151   friend std::ostream &  operator<< (
00152     std::ostream          &  os
00153   , const ELseverityLevel &  sev
00154   );
00155 
00156 private:
00157 
00158   // Data per ELseverityLevel object:
00159   //
00160   int    myLevel;
00161 
00162 };  // ELseverityLevel
00163 
00164 
00165 // ----------------------------------------------------------------------
00166 // Declare the globally available severity objects,
00167 // one generator function and one proxy per non-default ELsev_:
00168 // ----------------------------------------------------------------------
00169 
00170 extern ELslGen  ELzeroSeverityGen;
00171 extern ELslProxy< ELzeroSeverityGen    > const  ELzeroSeverity;
00172 
00173 extern ELslGen  ELincidentalGen;
00174 extern ELslProxy< ELincidentalGen      > const  ELincidental;
00175 
00176 extern ELslGen  ELsuccessGen;
00177 extern ELslProxy< ELsuccessGen         > const  ELsuccess;
00178 
00179 extern ELslGen  ELinfoGen;
00180 extern ELslProxy< ELinfoGen            > const  ELinfo;
00181 
00182 extern ELslGen  ELwarningGen;
00183 extern ELslProxy< ELwarningGen         > const  ELwarning;
00184 
00185 extern ELslGen  ELwarning2Gen;
00186 extern ELslProxy< ELwarning2Gen        > const  ELwarning2;
00187 
00188 extern ELslGen  ELerrorGen;
00189 extern ELslProxy< ELerrorGen           > const  ELerror;
00190 
00191 extern ELslGen  ELerror2Gen;
00192 extern ELslProxy< ELerror2Gen          > const  ELerror2;
00193 
00194 extern ELslGen  ELnextEventGen;
00195 extern ELslProxy< ELnextEventGen       > const  ELnextEvent;
00196 
00197 extern ELslGen  ELunspecifiedGen;
00198 extern ELslProxy< ELunspecifiedGen     > const  ELunspecified;
00199 
00200 extern ELslGen  ELsevereGen;
00201 extern ELslProxy< ELsevereGen          > const  ELsevere;
00202 
00203 extern ELslGen  ELsevere2Gen;
00204 extern ELslProxy< ELsevere2Gen         > const  ELsevere2;
00205 
00206 extern ELslGen  ELabortGen;
00207 extern ELslProxy< ELabortGen           > const  ELabort;
00208 
00209 extern ELslGen  ELfatalGen;
00210 extern ELslProxy< ELfatalGen           > const  ELfatal;
00211 
00212 extern ELslGen  ELhighestSeverityGen;
00213 extern ELslProxy< ELhighestSeverityGen > const  ELhighestSeverity;
00214 
00215 
00216 // ----------------------------------------------------------------------
00217 // Comparators:
00218 // ----------------------------------------------------------------------
00219 
00220 extern bool  operator== ( ELseverityLevel const & e1
00221                         , ELseverityLevel const & e2 );
00222 extern bool  operator!= ( ELseverityLevel const & e1
00223                         , ELseverityLevel const & e2 );
00224 extern bool  operator<  ( ELseverityLevel const & e1
00225                         , ELseverityLevel const & e2 );
00226 extern bool  operator<= ( ELseverityLevel const & e1
00227                         , ELseverityLevel const & e2 );
00228 extern bool  operator>  ( ELseverityLevel const & e1
00229                         , ELseverityLevel const & e2 );
00230 extern bool  operator>= ( ELseverityLevel const & e1
00231                         , ELseverityLevel const & e2 );
00232 
00233 
00234 // ----------------------------------------------------------------------
00235 
00236 }        // end of namespace edm
00237 
00238 
00239 // ----------------------------------------------------------------------
00240 
00241 #define ELSEVERITYLEVEL_ICC
00242   #include "FWCore/MessageLogger/interface/ELseverityLevel.icc"
00243 #undef  ELSEVERITYLEVEL_ICC
00244 
00245 
00246 // ----------------------------------------------------------------------
00247 
00248 #endif  // MessageLogger_ELseverityLevel_h
00249