Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:28:39

0001 #ifndef MessageLogger_ErrorSummaryEntry_h
0002 #define MessageLogger_ErrorSummaryEntry_h
0003 
0004 #include "FWCore/MessageLogger/interface/ELseverityLevel.h"
0005 
0006 #include <string>
0007 
0008 // ----------------------------------------------------------------------
0009 //
0010 // ErrorSummaryEntry.h - Structure to hold summary of a warning or error
0011 //          message issued in an event.
0012 //
0013 //   Usage:
0014 //  if (edm::FreshErrorsExist()) {
0015 //    std::vector(edm::ErrorSummaryEntry es = edm::LoggedErrorsSummary();
0016 //    package_as_product_in_the_event (es);
0017 //  }
0018 //
0019 //   edm::ErrorSummaryEntry is a very simple struct, containing only strings
0020 //   and an int; it is very suitable for inclusion in the event.
0021 //
0022 //   Unusual C++ practice warning:
0023 //     edm::ErrorSummaryEntry is a simple struct; its members are public and
0024 //     are accessed directly rather than through accessor functions.  Thus it
0025 //     **is reasonable** in this case to treat the code defining the
0026 //     edm::ErrorSummaryEntry as documentation of how to use it.
0027 //
0028 // 20-Aug-2008 mf   Created file.
0029 //
0030 // 22-Jun-2009 mf   Added severity to the structure.  This adds just one
0031 //          integer to the memory used.
0032 //
0033 // ----------------------------------------------------------------------
0034 
0035 namespace edm {
0036   namespace messagelogger {
0037     struct ErrorSummaryEntry {
0038       std::string category;
0039       std::string module;
0040       ELseverityLevel severity;
0041       unsigned int count;
0042       ErrorSummaryEntry(std::string const& cat, std::string const& mod, ELseverityLevel sev, unsigned int cnt = 0)
0043           : category(cat), module(mod), severity(sev), count(cnt) {}
0044       ErrorSummaryEntry() : category(), module(), severity(), count(0) {}
0045       bool operator<(ErrorSummaryEntry const& rhs) const {
0046         if (category < rhs.category)
0047           return true;
0048         if (category > rhs.category)
0049           return false;
0050         if (module < rhs.module)
0051           return true;
0052         if (module > rhs.module)
0053           return false;
0054         if (severity < rhs.severity)
0055           return true;
0056         if (severity > rhs.severity)
0057           return false;
0058         if (count < rhs.count)
0059           return true;
0060         return false;
0061       }
0062       bool operator==(ErrorSummaryEntry const& rhs) const {
0063         return ((category < rhs.category) && (module < rhs.module) && (severity < rhs.severity) && (count < rhs.count));
0064       }
0065     };
0066   }  // namespace messagelogger
0067 }  // end of namespace edm
0068 
0069 #endif  // MessageLogger_ErrorSummaryEntry_h