CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
edm::ErrorObj Class Reference

#include <ErrorObj.h>

Public Member Functions

virtual void clear ()
 
const std::string & context () const
 
virtual ErrorObjemitToken (std::string_view txt)
 
 ErrorObj (const messagelogger::ELseverityLevel &sev, std::string_view id, bool verbatim=false)
 
 ErrorObj (const ErrorObj &orig)
 
template<typename... Args>
ErrorObjformat (std::string_view fmt, Args const &... args)
 
std::string fullText () const
 
const std::string & idOverflow () const
 
bool is_verbatim () const
 
const ELlist_stringitems () const
 
ErrorObjoperator<< (std::ostream &(*f)(std::ostream &))
 
ErrorObjoperator<< (std::ios_base &(*f)(std::ios_base &))
 
ErrorObjoperator= (const ErrorObj &other)
 
template<class T >
ErrorObjopltlt (const T &t)
 
ErrorObjopltlt (const char s[])
 
bool reactedTo () const
 
int serial () const
 
virtual void set (const messagelogger::ELseverityLevel &sev, std::string_view id)
 
virtual void setContext (std::string_view context)
 
virtual void setID (std::string_view ID)
 
virtual void setModule (std::string_view module)
 
virtual void setReactedTo (bool r)
 
virtual void setSeverity (const messagelogger::ELseverityLevel &sev)
 
virtual void setSubroutine (std::string_view subroutine)
 
void swap (ErrorObj &other)
 
time_t timestamp () const
 
const ELextendedIDxid () const
 
virtual ~ErrorObj ()
 

Private Attributes

std::string emptyString
 
std::string myContext
 
std::string myIdOverflow
 
ELlist_string myItems
 
std::ostringstream myOs
 
bool myReactedTo
 
int mySerial
 
time_t myTimestamp
 
ELextendedID myXid
 
bool verbatim
 

Detailed Description

Definition at line 43 of file ErrorObj.h.

Constructor & Destructor Documentation

◆ ErrorObj() [1/2]

edm::ErrorObj::ErrorObj ( const messagelogger::ELseverityLevel sev,
std::string_view  id,
bool  verbatim = false 
)

Definition at line 83 of file ErrorObj.cc.

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, clear(), and triggerObjects_cff::id.

83  : verbatim(verbat) {
84 #ifdef ErrorObjCONSTRUCTOR_TRACE
85  std::cerr << "Constructor for ErrorObj\n";
86 #endif
87 
88  clear();
89  set(sev, id);
90 
91  } // ErrorObj()
virtual void clear()
Definition: ErrorObj.cc:228
bool verbatim
Definition: ErrorObj.h:103

◆ ErrorObj() [2/2]

edm::ErrorObj::ErrorObj ( const ErrorObj orig)

Definition at line 93 of file ErrorObj.cc.

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr.

94  : mySerial(orig.mySerial),
95  myXid(orig.myXid),
96  myIdOverflow(orig.myIdOverflow),
97  myTimestamp(orig.myTimestamp),
98  myItems(orig.myItems),
99  myReactedTo(orig.myReactedTo),
100  myOs(),
101  emptyString(),
102  verbatim(orig.verbatim) {
103 #ifdef ErrorObjCONSTRUCTOR_TRACE
104  std::cerr << "Copy Constructor for ErrorObj\n";
105 #endif
106 
107  } // ErrorObj(ErrorObj)
std::string emptyString
Definition: ErrorObj.h:102
time_t myTimestamp
Definition: ErrorObj.h:97
ELlist_string myItems
Definition: ErrorObj.h:98
ELextendedID myXid
Definition: ErrorObj.h:95
std::ostringstream myOs
Definition: ErrorObj.h:101
std::string myIdOverflow
Definition: ErrorObj.h:96
bool verbatim
Definition: ErrorObj.h:103
bool myReactedTo
Definition: ErrorObj.h:99
int mySerial
Definition: ErrorObj.h:94

◆ ~ErrorObj()

edm::ErrorObj::~ErrorObj ( )
virtual

Definition at line 109 of file ErrorObj.cc.

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr.

109  {
110 #ifdef ErrorObjCONSTRUCTOR_TRACE
111  std::cerr << "Destructor for ErrorObj\n";
112 #endif
113 
114  } // ~ErrorObj()

Member Function Documentation

◆ clear()

void edm::ErrorObj::clear ( void  )
virtual

Definition at line 228 of file ErrorObj.cc.

References edm::ELextendedID::clear(), myIdOverflow, myItems, myReactedTo, mySerial, myTimestamp, and myXid.

Referenced by ErrorObj(), and set().

228  {
229  mySerial = 0;
230  myXid.clear();
231  myIdOverflow = "";
232  myTimestamp = 0;
233  myItems.erase(myItems.begin(), myItems.end()); // myItems.clear();
234  myReactedTo = false;
235 
236  } // clear()
time_t myTimestamp
Definition: ErrorObj.h:97
ELlist_string myItems
Definition: ErrorObj.h:98
ELextendedID myXid
Definition: ErrorObj.h:95
std::string myIdOverflow
Definition: ErrorObj.h:96
bool myReactedTo
Definition: ErrorObj.h:99
int mySerial
Definition: ErrorObj.h:94

◆ context()

const std::string & edm::ErrorObj::context ( ) const

Definition at line 149 of file ErrorObj.cc.

References myContext.

149 { return myContext; }
std::string myContext
Definition: ErrorObj.h:100

◆ emitToken()

ErrorObj & edm::ErrorObj::emitToken ( std::string_view  txt)
virtual

Definition at line 192 of file ErrorObj.cc.

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, myItems, alignCSCRings::s, and setSubroutine().

Referenced by opltlt().

192  {
193 #ifdef ErrorObj_EMIT_TRACE
194  std::cerr << "=:=:=: ErrorObj::emitToken( " << s << " )\n";
195 #endif
196 
197 #ifdef ErrorObj_SUB_TRACE
198  if (subN > 0) {
199  std::cerr << "=:=:=: subN ErrorObj::emitToken( " << s << " )\n";
200  subN--;
201  }
202 #endif
203 
204  if (eq_nocase(s.substr(0, 5), "@SUB=")) {
205 #ifdef ErrorObj_SUB_TRACE
206  std::cerr << "=:=:=: ErrorObj::@SUB s.substr(5) is: " << s.substr(5) << '\n';
207 #endif
208  setSubroutine(s.substr(5));
209  } else {
210  myItems.emplace_back(s);
211  }
212 
213  return *this;
214 
215  } // emitToken()
ELlist_string myItems
Definition: ErrorObj.h:98
virtual void setSubroutine(std::string_view subroutine)
Definition: ErrorObj.cc:179

◆ format()

template<typename... Args>
ErrorObj& edm::ErrorObj::format ( std::string_view  fmt,
Args const &...  args 
)
inline

◆ fullText()

std::string edm::ErrorObj::fullText ( ) const

Definition at line 151 of file ErrorObj.cc.

References myItems, mps_fire::result, and AlCaHLTBitMon_QueryRunRegistry::string.

151  {
153  for (auto const& it : myItems)
154  result += it;
155  return result;
156  } // fullText()
ELlist_string myItems
Definition: ErrorObj.h:98

◆ idOverflow()

const std::string & edm::ErrorObj::idOverflow ( ) const

Definition at line 143 of file ErrorObj.cc.

References myIdOverflow.

143 { return myIdOverflow; }
std::string myIdOverflow
Definition: ErrorObj.h:96

◆ is_verbatim()

bool edm::ErrorObj::is_verbatim ( ) const

Definition at line 147 of file ErrorObj.cc.

References verbatim.

147 { return verbatim; }
bool verbatim
Definition: ErrorObj.h:103

◆ items()

const ELlist_string & edm::ErrorObj::items ( ) const

◆ operator<<() [1/2]

ErrorObj& edm::ErrorObj::operator<< ( std::ostream &(*)(std::ostream &)  f)
inline

◆ operator<<() [2/2]

ErrorObj& edm::ErrorObj::operator<< ( std::ios_base &(*)(std::ios_base &)  f)
inline

◆ operator=()

ErrorObj & edm::ErrorObj::operator= ( const ErrorObj other)

Definition at line 116 of file ErrorObj.cc.

References trackingPlots::other, swap(), and groupFilesInBlocks::temp.

116  {
118  this->swap(temp);
119  return *this;
120  }
void swap(ErrorObj &other)
Definition: ErrorObj.cc:122
ErrorObj(const messagelogger::ELseverityLevel &sev, std::string_view id, bool verbatim=false)
Definition: ErrorObj.cc:83

◆ opltlt() [1/2]

template<class T >
ErrorObj& edm::ErrorObj::opltlt ( const T t)
inline

◆ opltlt() [2/2]

ErrorObj & edm::ErrorObj::opltlt ( const char  s[])

Definition at line 238 of file ErrorObj.cc.

References emitToken(), emptyString, myOs, alignCSCRings::s, and verbatim.

238  {
239  // Exactly equivalent to the general template.
240  // If this is not provided explicitly, then the template will
241  // be instantiated once for each length of string ever used.
242  myOs.str(emptyString);
243  myOs << s;
244 #ifdef OLD_STYLE_AUTOMATIC_SPACES
245  if (!myOs.str().empty()) {
246  if (!verbatim) {
247  emitToken(myOs.str() + ' ');
248  } else {
249  emitToken(myOs.str());
250  }
251  }
252 #else
253  if (!myOs.str().empty())
254  emitToken(myOs.str());
255 #endif
256  return *this;
257  }
std::string emptyString
Definition: ErrorObj.h:102
virtual ErrorObj & emitToken(std::string_view txt)
Definition: ErrorObj.cc:192
std::ostringstream myOs
Definition: ErrorObj.h:101
bool verbatim
Definition: ErrorObj.h:103

◆ reactedTo()

bool edm::ErrorObj::reactedTo ( ) const

Definition at line 146 of file ErrorObj.cc.

References myReactedTo.

146 { return myReactedTo; }
bool myReactedTo
Definition: ErrorObj.h:99

◆ serial()

int edm::ErrorObj::serial ( ) const

Definition at line 141 of file ErrorObj.cc.

References mySerial.

141 { return mySerial; }
int mySerial
Definition: ErrorObj.h:94

◆ set()

void edm::ErrorObj::set ( const messagelogger::ELseverityLevel sev,
std::string_view  id 
)
virtual

Definition at line 217 of file ErrorObj.cc.

References clear(), mySerial, myTimestamp, edm::ourSerial(), setID(), setSeverity(), and protons_cff::time.

217  {
218  clear();
219 
220  myTimestamp = time(nullptr);
221  mySerial = ++ourSerial;
222 
223  setID(id);
224  setSeverity(sev);
225 
226  } // set()
time_t myTimestamp
Definition: ErrorObj.h:97
virtual void clear()
Definition: ErrorObj.cc:228
virtual void setSeverity(const messagelogger::ELseverityLevel &sev)
Definition: ErrorObj.cc:162
static std::atomic< int > ourSerial(0)
virtual void setID(std::string_view ID)
Definition: ErrorObj.cc:169
int mySerial
Definition: ErrorObj.h:94

◆ setContext()

void edm::ErrorObj::setContext ( std::string_view  context)
virtual

Definition at line 177 of file ErrorObj.cc.

References c, and myContext.

Referenced by edm::MessageSender::ErrorObjDeleter::operator()().

177 { myContext = c; }
std::string myContext
Definition: ErrorObj.h:100

◆ setID()

void edm::ErrorObj::setID ( std::string_view  ID)
virtual

Definition at line 169 of file ErrorObj.cc.

References edm::ELextendedID::id, edm::maxIDlength(), myIdOverflow, and myXid.

Referenced by edm::service::ThreadSafeLogMessageLoggerScribe::log(), set(), and edm::service::ThreadSafeLogMessageLoggerScribe::~ThreadSafeLogMessageLoggerScribe().

169  {
170  myXid.id = id.substr(0, maxIDlength);
171  if (id.length() > maxIDlength)
172  myIdOverflow = id.substr(maxIDlength, id.length() - maxIDlength);
173  }
ELextendedID myXid
Definition: ErrorObj.h:95
const unsigned int maxIDlength(200)
std::string myIdOverflow
Definition: ErrorObj.h:96
std::string id
Definition: ELextendedID.h:29

◆ setModule()

void edm::ErrorObj::setModule ( std::string_view  module)
virtual

Definition at line 175 of file ErrorObj.cc.

References edm::ELextendedID::module, callgraph::module, and myXid.

Referenced by edm::MessageSender::ErrorObjDeleter::operator()().

175 { myXid.module = module; }
std::string module
Definition: ELextendedID.h:31
ELextendedID myXid
Definition: ErrorObj.h:95

◆ setReactedTo()

void edm::ErrorObj::setReactedTo ( bool  r)
virtual

Definition at line 186 of file ErrorObj.cc.

References myReactedTo, and alignCSCRings::r.

186 { myReactedTo = r; }
bool myReactedTo
Definition: ErrorObj.h:99

◆ setSeverity()

void edm::ErrorObj::setSeverity ( const messagelogger::ELseverityLevel sev)
virtual

Definition at line 162 of file ErrorObj.cc.

References edm::ELdebug, edm::ELhighestSeverity, edm::ELsevere, edm::ELzeroSeverity, myXid, and edm::ELextendedID::severity.

Referenced by set().

162  {
163  using namespace edm::messagelogger;
166  : sev;
167  }
messagelogger::ELseverityLevel severity
Definition: ELextendedID.h:30
constexpr const ELseverityLevel ELhighestSeverity
constexpr const ELseverityLevel ELsevere
ELextendedID myXid
Definition: ErrorObj.h:95
constexpr const ELseverityLevel ELzeroSeverity
constexpr const ELseverityLevel ELdebug

◆ setSubroutine()

void edm::ErrorObj::setSubroutine ( std::string_view  subroutine)
virtual

Definition at line 179 of file ErrorObj.cc.

References EcnaPython_AdcPeg12_S1_10_R170298_1_0_150_Dee0::cerr, myXid, and edm::ELextendedID::subroutine.

Referenced by emitToken().

179  {
180 #ifdef ErrorObj_SUB_TRACE
181  std::cerr << "=:=:=: ErrorObj::setSubroutine(" << subroutine << ")\n";
182 #endif
183  myXid.subroutine = (subroutine[0] == ' ') ? subroutine.substr(1) : subroutine;
184  }
ELextendedID myXid
Definition: ErrorObj.h:95
std::string subroutine
Definition: ELextendedID.h:32

◆ swap()

void edm::ErrorObj::swap ( ErrorObj other)

Definition at line 122 of file ErrorObj.cc.

References emptyString, myContext, myIdOverflow, myItems, myOs, myReactedTo, mySerial, myTimestamp, myXid, trackingPlots::other, AlCaHLTBitMon_QueryRunRegistry::string, std::swap(), groupFilesInBlocks::temp, and verbatim.

Referenced by operator=().

122  {
123  std::swap(mySerial, other.mySerial);
124  std::swap(myXid, other.myXid);
125  myIdOverflow.swap(other.myIdOverflow);
126  std::swap(myTimestamp, other.myTimestamp);
127  myItems.swap(other.myItems);
128  std::swap(myReactedTo, other.myReactedTo);
129  myContext.swap(other.myContext);
130  std::string temp(other.myOs.str());
131  other.myOs.str(myOs.str());
132  myOs.str(temp);
133  emptyString.swap(other.emptyString);
134  std::swap(verbatim, other.verbatim);
135  }
std::string emptyString
Definition: ErrorObj.h:102
time_t myTimestamp
Definition: ErrorObj.h:97
ELlist_string myItems
Definition: ErrorObj.h:98
std::string myContext
Definition: ErrorObj.h:100
ELextendedID myXid
Definition: ErrorObj.h:95
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
std::ostringstream myOs
Definition: ErrorObj.h:101
std::string myIdOverflow
Definition: ErrorObj.h:96
bool verbatim
Definition: ErrorObj.h:103
bool myReactedTo
Definition: ErrorObj.h:99
int mySerial
Definition: ErrorObj.h:94

◆ timestamp()

time_t edm::ErrorObj::timestamp ( ) const

Definition at line 144 of file ErrorObj.cc.

References myTimestamp.

144 { return myTimestamp; }
time_t myTimestamp
Definition: ErrorObj.h:97

◆ xid()

const ELextendedID & edm::ErrorObj::xid ( ) const

Member Data Documentation

◆ emptyString

std::string edm::ErrorObj::emptyString
private

Definition at line 102 of file ErrorObj.h.

Referenced by opltlt(), and swap().

◆ myContext

std::string edm::ErrorObj::myContext
private

Definition at line 100 of file ErrorObj.h.

Referenced by context(), setContext(), and swap().

◆ myIdOverflow

std::string edm::ErrorObj::myIdOverflow
private

Definition at line 96 of file ErrorObj.h.

Referenced by clear(), idOverflow(), setID(), and swap().

◆ myItems

ELlist_string edm::ErrorObj::myItems
private

Definition at line 98 of file ErrorObj.h.

Referenced by clear(), emitToken(), fullText(), items(), and swap().

◆ myOs

std::ostringstream edm::ErrorObj::myOs
private

Definition at line 101 of file ErrorObj.h.

Referenced by opltlt(), and swap().

◆ myReactedTo

bool edm::ErrorObj::myReactedTo
private

Definition at line 99 of file ErrorObj.h.

Referenced by clear(), reactedTo(), setReactedTo(), and swap().

◆ mySerial

int edm::ErrorObj::mySerial
private

Definition at line 94 of file ErrorObj.h.

Referenced by clear(), serial(), set(), and swap().

◆ myTimestamp

time_t edm::ErrorObj::myTimestamp
private

Definition at line 97 of file ErrorObj.h.

Referenced by clear(), set(), swap(), and timestamp().

◆ myXid

ELextendedID edm::ErrorObj::myXid
private

Definition at line 95 of file ErrorObj.h.

Referenced by clear(), setID(), setModule(), setSeverity(), setSubroutine(), swap(), and xid().

◆ verbatim

bool edm::ErrorObj::verbatim
private

Definition at line 103 of file ErrorObj.h.

Referenced by is_verbatim(), opltlt(), and swap().