CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | Static Private Attributes | Friends
edm::service::ELadministrator Class Reference

#include <ELadministrator.h>

Public Member Functions

ELdestControl attach (const ELdestination &sink)
 
ELdestControl attach (const ELdestination &sink, const ELstring &name)
 
ELseverityLevel checkSeverity ()
 
void finish ()
 
const ELcontextSuppliergetContextSupplier () const
 
bool getELdestControl (const ELstring &name, ELdestControl &theControl)
 
void resetSeverityCount (const ELseverityLevel &sev)
 
void resetSeverityCount (const ELseverityLevel &from, const ELseverityLevel &to)
 
void resetSeverityCount ()
 
void setAbortThreshold (const ELseverityLevel &sev)
 
void setContextSupplier (const ELcontextSupplier &supplier)
 
void setExitThreshold (const ELseverityLevel &sev)
 
void setIntervals (const ELstring &id, int interval)
 
void setIntervals (const ELseverityLevel &sev, int interval)
 
void setLimits (const ELstring &id, int limit)
 
void setLimits (const ELseverityLevel &sev, int limit)
 
void setProcess (const ELstring &process)
 
void setThresholds (const ELseverityLevel &sev)
 
void setTimespans (const ELstring &id, int seconds)
 
void setTimespans (const ELseverityLevel &sev, int seconds)
 
int severityCount (const ELseverityLevel &sev) const
 
int severityCount (const ELseverityLevel &from, const ELseverityLevel &to) const
 
ELcontextSupplierswapContextSupplier (ELcontextSupplier &cs)
 
ELstring swapProcess (const ELstring &process)
 
void wipe ()
 

Static Public Member Functions

static ELadministratorinstance ()
 

Protected Member Functions

const ELseverityLevelabortThreshold () const
 
void clearMsg ()
 
ELcontextSuppliercontext () const
 
 ELadministrator ()
 
const ELseverityLevelexitThreshold () const
 
void finishMsg ()
 
const ELseverityLevelhighSeverity () const
 
const ELstringprocess () const
 
int severityCounts (int lev) const
 
std::list< boost::shared_ptr
< ELdestination > > & 
sinks ()
 
virtual ~ELadministrator ()
 

Private Attributes

ELseverityLevel abortThreshold_
 
std::map< ELstring,
boost::shared_ptr
< ELdestination > > 
attachedDestinations
 
boost::shared_ptr
< ELcontextSupplier
context_
 
ELseverityLevel exitThreshold_
 
ELseverityLevel highSeverity_
 
edm::ErrorObj msg
 
bool msgIsActive
 
ELstring process_
 
int severityCounts_ [ELseverityLevel::nLevels]
 
std::list< boost::shared_ptr
< ELdestination > > 
sinks_
 

Static Private Attributes

static ELadministratorinstance_ = 0
 

Friends

class ELadminDestroyer
 
class ELcout
 
class ELtsErrorLog
 
class ErrorLog
 

Detailed Description

Definition at line 81 of file ELadministrator.h.

Constructor & Destructor Documentation

edm::service::ELadministrator::ELadministrator ( )
protected

Definition at line 501 of file ELadministrator.cc.

References dtNoiseDBValidation_cfg::cerr, edm::ELseverityLevel::nLevels, and severityCounts_.

Referenced by instance().

502 : process_ ( "" )
504 , abortThreshold_( ELseverityLevel (ELseverityLevel::ELsev_abort) )
506 , sinks_ ( )
508 , msg ( ELseverityLevel (ELseverityLevel::ELsev_unspecified), "" )
509 , msgIsActive ( false )
510 {
511 
512  #ifdef ELadministratorCONSTRUCTOR_TRACE
513  std::cerr << "ELadminstrator constructor\n";
514  #endif
515 
516  for ( int lev = 0; lev < ELseverityLevel::nLevels; ++lev )
517  severityCounts_[lev] = 0;
518 
519 } // ELadministrator()
int severityCounts_[ELseverityLevel::nLevels]
static ELemptyContextSupplier emptyContext
virtual ELemptyContextSupplier * clone() const
boost::shared_ptr< ELcontextSupplier > context_
std::list< boost::shared_ptr< ELdestination > > sinks_
edm::service::ELadministrator::~ELadministrator ( )
protectedvirtual

Definition at line 543 of file ELadministrator.cc.

References dtNoiseDBValidation_cfg::cerr, finishMsg(), and sinks().

543  {
544 
545  #ifdef ELadministratorCONSTRUCTOR_TRACE
546  std::cerr << "ELadministrator Destructor\n";
547  #endif
548 
549  finishMsg();
550 
551  sinks().clear();
552 
553 } // ~ELadministrator()
std::list< boost::shared_ptr< ELdestination > > & sinks()

Member Function Documentation

const ELseverityLevel & edm::service::ELadministrator::abortThreshold ( ) const
protected

Definition at line 256 of file ELadministrator.cc.

References abortThreshold_.

Referenced by edm::service::ELtsErrorLog::dispatch(), finishMsg(), and edm::service::ErrorLog::operator()().

256  {
257  return abortThreshold_;
258 }
ELdestControl edm::service::ELadministrator::attach ( const ELdestination sink)
ELdestControl edm::service::ELadministrator::attach ( const ELdestination sink,
const ELstring name 
)

Definition at line 170 of file ELadministrator.cc.

References attachedDestinations, edm::service::ELdestination::clone(), alignCSCRings::dest, mergeVDriftHistosByStation::name, and sinks().

171  {
172  boost::shared_ptr<ELdestination> dest(sink.clone());
174  sinks().push_back( dest );
175  return ELdestControl( dest );
176 } // attach()
std::list< boost::shared_ptr< ELdestination > > & sinks()
std::map< ELstring, boost::shared_ptr< ELdestination > > attachedDestinations
ELseverityLevel edm::service::ELadministrator::checkSeverity ( )

Definition at line 191 of file ELadministrator.cc.

References edm::ELzeroSeverity, and highSeverity_.

191  {
192 
193  const ELseverityLevel retval( highSeverity_ );
195  return retval;
196 
197 } // checkSeverity()
ELslProxy< ELzeroSeverityGen > const ELzeroSeverity
void edm::service::ELadministrator::clearMsg ( )
protected

Definition at line 359 of file ELadministrator.cc.

References edm::ErrorObj::clear(), msg, and msgIsActive.

Referenced by edm::service::ErrorLog::endmsg().

359  {
360 
361  msgIsActive = false;
362  msg.clear();
363 
364 } // clearMsg()
virtual void clear()
Definition: ErrorObj.cc:262
ELcontextSupplier & edm::service::ELadministrator::context ( ) const
protected

Definition at line 253 of file ELadministrator.cc.

References context_.

253 { return *context_; }
boost::shared_ptr< ELcontextSupplier > context_
const ELseverityLevel & edm::service::ELadministrator::exitThreshold ( ) const
protected

Definition at line 260 of file ELadministrator.cc.

References exitThreshold_.

Referenced by finishMsg(), and edm::service::ErrorLog::operator()().

260  {
261  return exitThreshold_;
262 }
void edm::service::ELadministrator::finish ( )

Definition at line 442 of file ELadministrator.cc.

References begin, and sinks().

Referenced by progressbar.ProgressBar::__next__(), and edm::service::MessageLoggerScribe::~MessageLoggerScribe().

442  {
443 
444  std::list<boost::shared_ptr<ELdestination> >::iterator d;
445  for ( d = sinks().begin(); d != sinks().end(); ++d )
446  (*d)->finish();
447 
448 } // wipe()
std::list< boost::shared_ptr< ELdestination > > & sinks()
#define begin
Definition: vmac.h:31
void edm::service::ELadministrator::finishMsg ( )
protected

Definition at line 306 of file ELadministrator.cc.

References abortThreshold(), begin, dtNoiseDBValidation_cfg::cerr, context_, alignCSCRings::dest, end, exitThreshold(), edm::ELseverityLevel::getLevel(), highSeverity_, msg, msgIsActive, edm::service::possiblyAbortOrExit(), edm::ErrorObj::setReactedTo(), edm::ELextendedID::severity, severityCounts_, sinks(), and edm::ErrorObj::xid().

Referenced by edm::service::ErrorLog::endmsg(), and ~ELadministrator().

306  {
307 
308  if ( ! msgIsActive )
309  return;
310 
311  int lev = msg.xid().severity.getLevel();
312  ++ severityCounts_[lev];
313  if ( lev > highSeverity_.getLevel() )
315 
316  #ifdef ELadTRACE_FINISH
317  std::cerr << "=:=:=: finshMsg() - lev = " << lev << "\n";
318  #endif
319 
320  context_->editErrorObj( msg );
321 
322  #ifdef ELadTRACE_FINISH
323  std::cerr << "=:=:=: finshMsg() returns from editErrorObj( msg ) \n";
324  #endif
325 
326  std::list<boost::shared_ptr<ELdestination> >::iterator d;
327  bool mrt;
328  #ifdef ELadTRACE_FINISH
329  int destCounter = 0;
330  #endif
331  if ( sinks().begin() == sinks().end() ) { // $$ JV:1
332  std::cerr << "\nERROR LOGGED WITHOUT DESTINATION!\n";
333  std::cerr << "Attaching destination \"cerr\" to ELadministrator by default\n\n";
334  boost::shared_ptr<ELdestination> dest(new ELoutput(cerr));
335  this->sinks().push_back(dest);
336  }
337  for ( d = sinks().begin(); d != sinks().end(); ++d ) {
338  #ifdef ELadTRACE_FINISH
339  std::cerr << " =:=:=: log(msg) for a destination number "
340  << ++destCounter << " called ... \n";
341  #endif
342  mrt = (*d)->log( msg );
343  #ifdef ELadTRACE_FINISH
344  std::cerr << " =:=:=: log(msg) for a destination returned " << mrt << "\n";
345  #endif
346  if ( mrt )
347  msg.setReactedTo(true);
348  }
349 
350  msgIsActive = false;
351 
352  possiblyAbortOrExit ( lev,
353  abortThreshold().getLevel(),
354  exitThreshold().getLevel() ); // $$ mf 3/17/04
355 
356 } // finishMsg()
ELseverityLevel severity
Definition: ELextendedID.h:36
std::list< boost::shared_ptr< ELdestination > > & sinks()
int severityCounts_[ELseverityLevel::nLevels]
virtual void setReactedTo(bool r)
Definition: ErrorObj.cc:210
const ELextendedID & xid() const
Definition: ErrorObj.cc:146
#define end
Definition: vmac.h:38
boost::shared_ptr< ELcontextSupplier > context_
static void possiblyAbortOrExit(int s, int a, int e)
#define begin
Definition: vmac.h:31
const ELseverityLevel & exitThreshold() const
const ELseverityLevel & abortThreshold() const
const ELcontextSupplier & edm::service::ELadministrator::getContextSupplier ( ) const

Definition at line 136 of file ELadministrator.cc.

References context_.

Referenced by edm::ELlog4cplus::log(), edm::service::ELoutput::log(), edm::service::ELstatistics::log(), and edm::service::MessageLoggerScribe::log().

136  {
137 
138  return *(context_);
139 
140 } // getContextSupplier()
boost::shared_ptr< ELcontextSupplier > context_
bool edm::service::ELadministrator::getELdestControl ( const ELstring name,
ELdestControl theControl 
)

Definition at line 179 of file ELadministrator.cc.

References attachedDestinations.

Referenced by edm::service::ELtsErrorLog::getELdestControl(), and edm::service::ErrorLog::getELdestControl().

180  {
181 
182  if ( attachedDestinations.find(name) != attachedDestinations.end() ) {
183  theDestControl = ELdestControl ( attachedDestinations[name] );
184  return true;
185  } else {
186  return false;
187  }
188 
189 } // getDestControl
std::map< ELstring, boost::shared_ptr< ELdestination > > attachedDestinations
const ELseverityLevel & edm::service::ELadministrator::highSeverity ( ) const
protected

Definition at line 267 of file ELadministrator.cc.

References highSeverity_.

267  {
268  return highSeverity_;
269 }
ELadministrator * edm::service::ELadministrator::instance ( )
static

Definition at line 485 of file ELadministrator.cc.

References ELadministrator(), instance_, and edm::service::ELadminDestroyer::setELadmin().

Referenced by edm::service::ELrecv(), edm::service::ELerrorList::log(), edm::service::ELoutput::log(), edm::ELlog4cplus::log(), edm::service::ELstatistics::log(), and edm::service::ELcollected::log().

485  {
486 
487  static ELadminDestroyer destroyer_;
488  // This deviates from Vlissides' pattern where destroyer_ was a static
489  // instance in the ELadministrator class. This construct should be
490  // equivalent, but the original did not call the destructor under KCC.
491 
492  if ( !instance_ ) {
494  destroyer_.setELadmin( instance_ );
495  }
496  return instance_;
497 
498 } // instance()
static ELadministrator * instance_
const ELstring & edm::service::ELadministrator::process ( ) const
protected
void edm::service::ELadministrator::resetSeverityCount ( const ELseverityLevel sev)

Definition at line 223 of file ELadministrator.cc.

References edm::ELseverityLevel::getLevel(), and severityCounts_.

223  {
224 
225  severityCounts_[sev.getLevel()] = 0;
226 
227 } // resetSeverityCount()
int severityCounts_[ELseverityLevel::nLevels]
void edm::service::ELadministrator::resetSeverityCount ( const ELseverityLevel from,
const ELseverityLevel to 
)

Definition at line 230 of file ELadministrator.cc.

References edm::ELseverityLevel::getLevel(), gen::k, and severityCounts_.

231  {
232 
233  for ( int k = from.getLevel(); k <= to.getLevel(); ++k )
234  severityCounts_[k] = 0;
235 
236 } // resetSeverityCount()
int severityCounts_[ELseverityLevel::nLevels]
int k[5][pyjets_maxn]
static std::string from(" from ")
void edm::service::ELadministrator::resetSeverityCount ( )

Definition at line 239 of file ELadministrator.cc.

References edm::ELhighestSeverity, and edm::ELzeroSeverity.

239  {
240 
242 
243 } // resetSeverityCount()
ELslProxy< ELhighestSeverityGen > const ELhighestSeverity
ELslProxy< ELzeroSeverityGen > const ELzeroSeverity
void edm::service::ELadministrator::setAbortThreshold ( const ELseverityLevel sev)

Definition at line 150 of file ELadministrator.cc.

References abortThreshold_.

150  {
151 
152  abortThreshold_ = sev;
153 
154 } // setAbortThreshold()
void edm::service::ELadministrator::setContextSupplier ( const ELcontextSupplier supplier)

Definition at line 129 of file ELadministrator.cc.

References edm::service::ELcontextSupplier::clone(), and context_.

Referenced by edm::service::MessageLoggerScribe::MessageLoggerScribe().

129  {
130 
131  context_.reset(supplier.clone());
132 
133 } // setContextSupplier()
boost::shared_ptr< ELcontextSupplier > context_
void edm::service::ELadministrator::setExitThreshold ( const ELseverityLevel sev)

Definition at line 156 of file ELadministrator.cc.

References exitThreshold_.

156  {
157 
158  exitThreshold_ = sev;
159 
160 } // setExitThreshold()
void edm::service::ELadministrator::setIntervals ( const ELstring id,
int  interval 
)

Definition at line 398 of file ELadministrator.cc.

References begin, and sinks().

398  {
399 
400  std::list<boost::shared_ptr<ELdestination> >::iterator d;
401  for ( d = sinks().begin(); d != sinks().end(); ++d )
402  (*d)->limits.setInterval( id, interval );
403 
404 } // setIntervals()
std::list< boost::shared_ptr< ELdestination > > & sinks()
tuple interval
Definition: MergeJob_cfg.py:20
#define begin
Definition: vmac.h:31
void edm::service::ELadministrator::setIntervals ( const ELseverityLevel sev,
int  interval 
)

Definition at line 390 of file ELadministrator.cc.

References begin.

390  {
391 
392  std::list<boost::shared_ptr<ELdestination> >::iterator d;
393  for ( d = sinks().begin(); d != sinks().end(); ++d )
394  (*d)->limits.setInterval( sev, interval );
395 
396 } // setIntervals()
std::list< boost::shared_ptr< ELdestination > > & sinks()
tuple interval
Definition: MergeJob_cfg.py:20
#define begin
Definition: vmac.h:31
void edm::service::ELadministrator::setLimits ( const ELstring id,
int  limit 
)

Definition at line 380 of file ELadministrator.cc.

References begin, and sinks().

380  {
381 
382  std::list<boost::shared_ptr<ELdestination> >::iterator d;
383  for ( d = sinks().begin(); d != sinks().end(); ++d )
384  (*d)->limits.setLimit( id, limit );
385 
386 } // setLimits()
std::list< boost::shared_ptr< ELdestination > > & sinks()
#define begin
Definition: vmac.h:31
void edm::service::ELadministrator::setLimits ( const ELseverityLevel sev,
int  limit 
)

Definition at line 407 of file ELadministrator.cc.

References begin, and sinks().

407  {
408 
409  std::list<boost::shared_ptr<ELdestination> >::iterator d;
410  for ( d = sinks().begin(); d != sinks().end(); ++d )
411  (*d)->limits.setLimit( sev, limit );
412 
413 } // setLimits()
std::list< boost::shared_ptr< ELdestination > > & sinks()
#define begin
Definition: vmac.h:31
void edm::service::ELadministrator::setProcess ( const ELstring process)

Definition at line 110 of file ELadministrator.cc.

References dtNoiseDBValidation_cfg::cerr, process(), and process_.

110  {
111 
112  process_ = process;
113  #if 0
114  std::cerr << "Administrator process set to \"" << process << "\"\n";
115  #endif
116 
117 } // setProcess()
const ELstring & process() const
void edm::service::ELadministrator::setThresholds ( const ELseverityLevel sev)

Definition at line 371 of file ELadministrator.cc.

References begin, and sinks().

371  {
372 
373  std::list<boost::shared_ptr<ELdestination> >::iterator d;
374  for ( d = sinks().begin(); d != sinks().end(); ++d )
375  (*d)->threshold = sev;
376 
377 } // setThresholds()
std::list< boost::shared_ptr< ELdestination > > & sinks()
#define begin
Definition: vmac.h:31
void edm::service::ELadministrator::setTimespans ( const ELstring id,
int  seconds 
)

Definition at line 416 of file ELadministrator.cc.

References begin, and sinks().

416  {
417 
418  std::list<boost::shared_ptr<ELdestination> >::iterator d;
419  for ( d = sinks().begin(); d != sinks().end(); ++d )
420  (*d)->limits.setTimespan( id, seconds );
421 
422 } // setTimespans()
std::list< boost::shared_ptr< ELdestination > > & sinks()
double seconds()
#define begin
Definition: vmac.h:31
void edm::service::ELadministrator::setTimespans ( const ELseverityLevel sev,
int  seconds 
)

Definition at line 425 of file ELadministrator.cc.

References begin, and sinks().

425  {
426 
427  std::list<boost::shared_ptr<ELdestination> >::iterator d;
428  for ( d = sinks().begin(); d != sinks().end(); ++d )
429  (*d)->limits.setTimespan( sev, seconds );
430 
431 } // setTimespans()
std::list< boost::shared_ptr< ELdestination > > & sinks()
double seconds()
#define begin
Definition: vmac.h:31
int edm::service::ELadministrator::severityCount ( const ELseverityLevel sev) const

Definition at line 200 of file ELadministrator.cc.

References edm::ELseverityLevel::getLevel(), and severityCounts_.

200  {
201 
202  return severityCounts_[sev.getLevel()];
203 
204 } // severityCount()
int severityCounts_[ELseverityLevel::nLevels]
int edm::service::ELadministrator::severityCount ( const ELseverityLevel from,
const ELseverityLevel to 
) const

Definition at line 207 of file ELadministrator.cc.

References edm::ELseverityLevel::getLevel(), gen::k, and severityCounts_.

210  {
211 
212  int k = from.getLevel();
213  int sum = severityCounts_[k];
214 
215  while ( ++k != to.getLevel() )
216  sum += severityCounts_[k];
217 
218  return sum;
219 
220 } // severityCount()
int severityCounts_[ELseverityLevel::nLevels]
int k[5][pyjets_maxn]
static std::string from(" from ")
int edm::service::ELadministrator::severityCounts ( int  lev) const
protected

Definition at line 272 of file ELadministrator.cc.

References severityCounts_.

272  {
273  return severityCounts_[lev];
274 }
int severityCounts_[ELseverityLevel::nLevels]
std::list< boost::shared_ptr< ELdestination > > & edm::service::ELadministrator::sinks ( )
protected
ELcontextSupplier & edm::service::ELadministrator::swapContextSupplier ( ELcontextSupplier cs)

Definition at line 143 of file ELadministrator.cc.

Referenced by edm::service::ELrecv().

143  {
144  ELcontextSupplier & save = *(context_);
145  context_.reset(&cs);
146  return save;
147 } // swapContextSupplier
auto_ptr< ClusterSequence > cs
boost::shared_ptr< ELcontextSupplier > context_
ELstring edm::service::ELadministrator::swapProcess ( const ELstring process)

Definition at line 120 of file ELadministrator.cc.

References process(), process_, and groupFilesInBlocks::temp.

Referenced by edm::service::ELrecv().

120  {
121 
123  process_ = process;
124  return temp;
125 
126 } // swapProcess()
const ELstring & process() const
std::string ELstring
Definition: ELstring.h:26
void edm::service::ELadministrator::wipe ( )

Definition at line 434 of file ELadministrator.cc.

References begin, and sinks().

434  {
435 
436  std::list<boost::shared_ptr<ELdestination> >::iterator d;
437  for ( d = sinks().begin(); d != sinks().end(); ++d )
438  (*d)->limits.wipe();
439 
440 } // wipe()
std::list< boost::shared_ptr< ELdestination > > & sinks()
#define begin
Definition: vmac.h:31

Friends And Related Function Documentation

friend class ELadminDestroyer
friend

Definition at line 83 of file ELadministrator.h.

friend class ELcout
friend

Definition at line 85 of file ELadministrator.h.

friend class ELtsErrorLog
friend

Definition at line 86 of file ELadministrator.h.

friend class ErrorLog
friend

Definition at line 84 of file ELadministrator.h.

Member Data Documentation

ELseverityLevel edm::service::ELadministrator::abortThreshold_
private

Definition at line 167 of file ELadministrator.h.

Referenced by abortThreshold(), and setAbortThreshold().

std::map< ELstring, boost::shared_ptr<ELdestination> > edm::service::ELadministrator::attachedDestinations
private

Definition at line 175 of file ELadministrator.h.

Referenced by attach(), and getELdestControl().

boost::shared_ptr<ELcontextSupplier> edm::service::ELadministrator::context_
private
ELseverityLevel edm::service::ELadministrator::exitThreshold_
private

Definition at line 168 of file ELadministrator.h.

Referenced by exitThreshold(), and setExitThreshold().

ELseverityLevel edm::service::ELadministrator::highSeverity_
private
ELadministrator * edm::service::ELadministrator::instance_ = 0
staticprivate

Definition at line 161 of file ELadministrator.h.

Referenced by instance().

edm::ErrorObj edm::service::ELadministrator::msg
private
bool edm::service::ELadministrator::msgIsActive
private
ELstring edm::service::ELadministrator::process_
private

Definition at line 165 of file ELadministrator.h.

Referenced by process(), setProcess(), and swapProcess().

int edm::service::ELadministrator::severityCounts_[ELseverityLevel::nLevels]
private
std::list<boost::shared_ptr<ELdestination> > edm::service::ELadministrator::sinks_
private

Definition at line 169 of file ELadministrator.h.

Referenced by sinks().