CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/FWCore/MessageLogger/interface/ErrorSummaryEntry.h

Go to the documentation of this file.
00001 #ifndef MessageLogger_ErrorSummaryEntry_h
00002 #define MessageLogger_ErrorSummaryEntry_h
00003 
00004 #include "FWCore/MessageLogger/interface/ELseverityLevel.h"
00005 
00006 #include <string>
00007 
00008 // ----------------------------------------------------------------------
00009 //
00010 // ErrorSummaryEntry.h - Structure to hold summary of a warning or error
00011 //                  message issued in an event.  
00012 //
00013 //   Usage:  
00014 //      if (edm::FreshErrorsExist()) {
00015 //        std::vector(edm::ErrorSummaryEntry es = edm::LoggedErrorsSummary();
00016 //        package_as_product_in_the_event (es);
00017 //      }
00018 //
00019 //   edm::ErrorSummaryEntry is a very simple struct, containing only strings
00020 //   and an int; it is very suitable for inclusion in the event.
00021 //
00022 //   Unusual C++ practice warning:
00023 //     edm::ErrorSummaryEntry is a simple struct; its members are public and
00024 //     are accessed directly rather than through accessor functions.  Thus it
00025 //     **is reasonable** in this case to treat the code defining the
00026 //     edm::ErrorSummaryEntry as documentation of how to use it.
00027 //
00028 // 20-Aug-2008 mf       Created file.
00029 // 
00030 // 22-Jun-2009 mf       Added severity to the structure.  This adds just one
00031 //                      integer to the memory used.
00032 //
00033 // ----------------------------------------------------------------------
00034 
00035 namespace edm {       
00036 
00037 struct ErrorSummaryEntry 
00038 {
00039   std::string     category;
00040   std::string     module;
00041   ELseverityLevel severity;
00042   unsigned int    count;
00043   ErrorSummaryEntry(std::string const & cat, std::string const & mod, 
00044                     ELseverityLevel sev, unsigned int cnt = 0) 
00045         : category(cat)
00046         , module  (mod)
00047         , severity(sev)
00048         , count(cnt) {}
00049   ErrorSummaryEntry() : category(), module(), severity(), count(0) {}
00050   bool operator< (ErrorSummaryEntry const & rhs) const {
00051     if (category < rhs.category) return true;
00052     if (category > rhs.category) return false; 
00053     if (module   < rhs.module)   return true;
00054     if (module   > rhs.module)   return false; 
00055     if (severity < rhs.severity) return true;
00056     if (severity > rhs.severity) return false; 
00057     if (count    < rhs.count)    return true;
00058     return false; 
00059   }
00060   bool operator== (ErrorSummaryEntry const & rhs) const {
00061     return ( (category < rhs.category) && (module < rhs.module)
00062           && (severity < rhs.severity) && (count  < rhs.count)  );
00063   }
00064 };
00065 
00066 }        // end of namespace edm
00067 
00068 
00069 #endif  // MessageLogger_ErrorSummaryEntry_h
00070