CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
sistrip::WarningSummary Class Reference

#include <WarningSummary.h>

Public Member Functions

void add (const std::string &message, const std::string &details="")
 
void printSummary () const
 
 WarningSummary (const std::string &category, const std::string &name, bool debug=false)
 

Private Attributes

std::string m_category
 
bool m_debug
 
std::string m_name
 
std::map< std::string,
std::size_t > 
m_warnings
 

Detailed Description

Definition at line 8 of file WarningSummary.h.

Constructor & Destructor Documentation

sistrip::WarningSummary::WarningSummary ( const std::string &  category,
const std::string &  name,
bool  debug = false 
)
inline

Definition at line 10 of file WarningSummary.h.

Member Function Documentation

void sistrip::WarningSummary::add ( const std::string &  message,
const std::string &  details = "" 
)

Definition at line 6 of file WarningSummary.cc.

References m_category, m_debug, and m_warnings.

Referenced by sistrip::RawToDigiUnpacker::createDigis(), sistrip::DigiToRaw::createFedBuffers_(), counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

6  {
7  const auto wIt = m_warnings.find(message);
8  if (wIt == m_warnings.end()) {
9  m_warnings.emplace(message, 1);
10  edm::LogWarning(m_category) << message << ": " << details
11  << (m_debug ? ""
12  : "\nNote: further warnings of this type will be suppressed (this can be "
13  "changed by enabling debugging printout)");
14  } else {
15  ++(wIt->second);
16  if (m_debug) {
17  edm::LogWarning(m_category) << message << ": " << details;
18  }
19  }
20 }
std::map< std::string, std::size_t > m_warnings
Log< level::Warning, false > LogWarning
void sistrip::WarningSummary::printSummary ( ) const

Definition at line 22 of file WarningSummary.cc.

22  {
23  if (!m_warnings.empty()) {
24  std::stringstream message;
25  message << m_name << " warnings:";
26  for (const auto& warnAndCount : m_warnings) {
27  message << std::endl << warnAndCount.first << " (" << warnAndCount.second << ")";
28  }
29  edm::LogWarning(m_category) << message.str();
30  }
31 }
std::map< std::string, std::size_t > m_warnings
Log< level::Warning, false > LogWarning

Member Data Documentation

std::string sistrip::WarningSummary::m_category
private

Definition at line 18 of file WarningSummary.h.

Referenced by add().

bool sistrip::WarningSummary::m_debug
private

Definition at line 17 of file WarningSummary.h.

Referenced by add().

std::string sistrip::WarningSummary::m_name
private

Definition at line 19 of file WarningSummary.h.

std::map<std::string, std::size_t> sistrip::WarningSummary::m_warnings
private

Definition at line 20 of file WarningSummary.h.

Referenced by add().