ErrorSummaryEntry

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
#ifndef DataFormats_Common_ErrorSummaryEntry_h
#define DataFormats_Common_ErrorSummaryEntry_h

#include "DataFormats/Common/interface/ELseverityLevel.h"

#include <string>

// ----------------------------------------------------------------------
//
// ErrorSummaryEntry.h - Structure to hold summary of a warning or error
//		    message issued in an event.
//
//   Usage:
//	if (edm::FreshErrorsExist()) {
//	  std::vector(edm::ErrorSummaryEntry es = edm::LoggedErrorsSummary();
//	  package_as_product_in_the_event (es);
//	}
//
//   edm::ErrorSummaryEntry is a very simple struct, containing only strings
//   and an int; it is very suitable for inclusion in the event.
//
//   Unusual C++ practice warning:
//     edm::ErrorSummaryEntry is a simple struct; its members are public and
//     are accessed directly rather than through accessor functions.  Thus it
//     **is reasonable** in this case to treat the code defining the
//     edm::ErrorSummaryEntry as documentation of how to use it.
//
// 20-Aug-2008 mf	Created file.
//
// 22-Jun-2009 mf	Added severity to the structure.  This adds just one
//			integer to the memory used.
//
// ----------------------------------------------------------------------

namespace edm {
  struct ErrorSummaryEntry {
    std::string category;
    std::string module;
    ELseverityLevel severity;
    unsigned int count;
    ErrorSummaryEntry(std::string const& cat, std::string const& mod, ELseverityLevel sev, unsigned int cnt = 0)
        : category(cat), module(mod), severity(sev), count(cnt) {}
    ErrorSummaryEntry() : category(), module(), severity(), count(0) {}
    bool operator<(ErrorSummaryEntry const& rhs) const {
      if (category < rhs.category)
        return true;
      if (category > rhs.category)
        return false;
      if (module < rhs.module)
        return true;
      if (module > rhs.module)
        return false;
      if (severity < rhs.severity)
        return true;
      if (severity > rhs.severity)
        return false;
      if (count < rhs.count)
        return true;
      return false;
    }
    bool operator==(ErrorSummaryEntry const& rhs) const {
      return ((category < rhs.category) && (module < rhs.module) && (severity < rhs.severity) && (count < rhs.count));
    }
  };
}  // end of namespace edm

#endif  // DataFormats_Common_ErrorSummaryEntry_h