Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:03:51

0001 #ifndef DataFormats_Common_ErrorSummaryEntry_h
0002 #define DataFormats_Common_ErrorSummaryEntry_h
0003 
0004 #include "DataFormats/Common/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   struct ErrorSummaryEntry {
0037     std::string category;
0038     std::string module;
0039     ELseverityLevel severity;
0040     unsigned int count;
0041     ErrorSummaryEntry(std::string const& cat, std::string const& mod, ELseverityLevel sev, unsigned int cnt = 0)
0042         : category(cat), module(mod), severity(sev), count(cnt) {}
0043     ErrorSummaryEntry() : category(), module(), severity(), count(0) {}
0044     bool operator<(ErrorSummaryEntry const& rhs) const {
0045       if (category < rhs.category)
0046         return true;
0047       if (category > rhs.category)
0048         return false;
0049       if (module < rhs.module)
0050         return true;
0051       if (module > rhs.module)
0052         return false;
0053       if (severity < rhs.severity)
0054         return true;
0055       if (severity > rhs.severity)
0056         return false;
0057       if (count < rhs.count)
0058         return true;
0059       return false;
0060     }
0061     bool operator==(ErrorSummaryEntry const& rhs) const {
0062       return ((category < rhs.category) && (module < rhs.module) && (severity < rhs.severity) && (count < rhs.count));
0063     }
0064   };
0065 }  // end of namespace edm
0066 
0067 #endif  // DataFormats_Common_ErrorSummaryEntry_h