CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | Static Private Attributes | Friends

edm::service::ELadministrator Class Reference

#include <ELadministrator.h>

List of all members.

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 ()
void resetSeverityCount (const ELseverityLevel &sev)
void resetSeverityCount (const ELseverityLevel &from, const ELseverityLevel &to)
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 &from, const ELseverityLevel &to) const
int severityCount (const ELseverityLevel &sev) 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 benchmark_cfg::cerr, edm::ELseverityLevel::nLevels, and severityCounts_.

Referenced by instance().

: process_       ( ""                                                        )
, context_       ( emptyContext.clone()                                      )
, abortThreshold_( ELseverityLevel (ELseverityLevel::ELsev_abort)            )
, exitThreshold_ ( ELseverityLevel (ELseverityLevel::ELsev_highestSeverity   )            )
, sinks_         (                                                           )
, highSeverity_  ( ELseverityLevel (ELseverityLevel::ELsev_zeroSeverity)     )
, msg            ( ELseverityLevel (ELseverityLevel::ELsev_unspecified), ""  )
, msgIsActive    ( false                                                     )
{

  #ifdef ELadministratorCONSTRUCTOR_TRACE
    std::cerr << "ELadminstrator constructor\n";
  #endif

  for ( int lev = 0;  lev < ELseverityLevel::nLevels;  ++lev )
    severityCounts_[lev] = 0;

}  // ELadministrator()
edm::service::ELadministrator::~ELadministrator ( ) [protected, virtual]

Definition at line 543 of file ELadministrator.cc.

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

                                   {

  #ifdef ELadministratorCONSTRUCTOR_TRACE
    std::cerr << "ELadministrator Destructor\n";
  #endif

  finishMsg();

  sinks().clear();

}  // ~ELadministrator()

Member Function Documentation

const ELseverityLevel & edm::service::ELadministrator::abortThreshold ( ) const [protected]
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(), alignmentValidation::dest, mergeVDriftHistosByStation::name, and sinks().

                                                                    {
  boost::shared_ptr<ELdestination> dest(sink.clone());
  attachedDestinations[name] = dest;
  sinks().push_back( dest );
  return ELdestControl( dest );
} // attach()
ELdestControl edm::service::ELadministrator::attach ( const ELdestination sink)
ELseverityLevel edm::service::ELadministrator::checkSeverity ( )

Definition at line 191 of file ELadministrator.cc.

References edm::ELzeroSeverity, and highSeverity_.

                                                 {

  const ELseverityLevel  retval( highSeverity_ );
  highSeverity_ = ELzeroSeverity;
  return retval;

}  // checkSeverity()
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().

                                {

  msgIsActive = false;
  msg.clear();

}  // clearMsg()
ELcontextSupplier & edm::service::ELadministrator::context ( ) const [protected]

Definition at line 253 of file ELadministrator.cc.

References context_.

{ return *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()().

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

Definition at line 442 of file ELadministrator.cc.

References begin, and sinks().

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

                              {

  std::list<boost::shared_ptr<ELdestination> >::iterator d;
  for ( d = sinks().begin();  d != sinks().end();  ++d )
    (*d)->finish();

}  // wipe()
void edm::service::ELadministrator::finishMsg ( ) [protected]

Definition at line 306 of file ELadministrator.cc.

References abortThreshold(), begin, benchmark_cfg::cerr, context_, alignmentValidation::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().

                                 {

  if ( ! msgIsActive )
    return;

  int lev = msg.xid().severity.getLevel();
  ++ severityCounts_[lev];
  if ( lev > highSeverity_.getLevel() )
    highSeverity_ = msg.xid().severity;

  #ifdef ELadTRACE_FINISH
    std::cerr << "=:=:=: finshMsg() - lev = " << lev << "\n";
  #endif

  context_->editErrorObj( msg );

  #ifdef ELadTRACE_FINISH
    std::cerr << "=:=:=: finshMsg() returns from editErrorObj( msg ) \n";
  #endif

  std::list<boost::shared_ptr<ELdestination> >::iterator d;
  bool mrt;
  #ifdef ELadTRACE_FINISH
    int destCounter = 0;
  #endif
  if ( sinks().begin() == sinks().end() )  {                   // $$ JV:1
    std::cerr << "\nERROR LOGGED WITHOUT DESTINATION!\n";
    std::cerr << "Attaching destination \"cerr\" to ELadministrator by default\n\n";
    boost::shared_ptr<ELdestination> dest(new ELoutput(cerr));
    this->sinks().push_back(dest);
  }
  for ( d = sinks().begin();  d != sinks().end();  ++d )  {
    #ifdef ELadTRACE_FINISH
      std::cerr << "  =:=:=: log(msg) for a destination number "
           << ++destCounter << " called ... \n";
    #endif
    mrt = (*d)->log( msg );
    #ifdef ELadTRACE_FINISH
      std::cerr << "  =:=:=: log(msg) for a destination returned " << mrt << "\n";
    #endif
    if ( mrt )
      msg.setReactedTo(true);
  }

  msgIsActive = false;

  possiblyAbortOrExit ( lev,
                        abortThreshold().getLevel(),
                        exitThreshold().getLevel()   );         // $$ mf 3/17/04

}  // finishMsg()
const ELcontextSupplier & edm::service::ELadministrator::getContextSupplier ( ) const

Definition at line 136 of file ELadministrator.cc.

References context_.

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

                                                                     {

  return *(context_);

}  // getContextSupplier()
bool edm::service::ELadministrator::getELdestControl ( const ELstring name,
ELdestControl theControl 
)

Definition at line 179 of file ELadministrator.cc.

References attachedDestinations.

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

                                                                          {

  if ( attachedDestinations.find(name) != attachedDestinations.end() ) {
    theDestControl = ELdestControl ( attachedDestinations[name] );
    return true;
  } else {
    return false;
  }

} // getDestControl
const ELseverityLevel & edm::service::ELadministrator::highSeverity ( ) const [protected]

Definition at line 267 of file ELadministrator.cc.

References highSeverity_.

                                                             {
  return highSeverity_;
}
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::service::ELcollected::log(), edm::service::ELstatistics::log(), and edm::ELlog4cplus::log().

                                             {

  static ELadminDestroyer destroyer_;
  // This deviates from Vlissides' pattern where destroyer_ was a static
  // instance in the ELadministrator class.  This construct should be
  // equivalent, but the original did not call the destructor under KCC.

  if ( !instance_ )  {
    instance_ = new ELadministrator;
    destroyer_.setELadmin( instance_ );
  }
  return instance_;

}  // instance()
const ELstring & edm::service::ELadministrator::process ( ) const [protected]

Definition at line 250 of file ELadministrator.cc.

References process_.

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

{ return process_; }
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_.

                                                                          {

  for ( int k = from.getLevel();  k <= to.getLevel();  ++k )
    severityCounts_[k] = 0;

}  // resetSeverityCount()
void edm::service::ELadministrator::resetSeverityCount ( )

Definition at line 239 of file ELadministrator.cc.

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

                                          {

  resetSeverityCount( ELzeroSeverity, ELhighestSeverity );

}  // resetSeverityCount()
void edm::service::ELadministrator::resetSeverityCount ( const ELseverityLevel sev)

Definition at line 223 of file ELadministrator.cc.

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

                                                                       {

  severityCounts_[sev.getLevel()] = 0;

}  // resetSeverityCount()
void edm::service::ELadministrator::setAbortThreshold ( const ELseverityLevel sev)

Definition at line 150 of file ELadministrator.cc.

References abortThreshold_.

                                                                      {

  abortThreshold_ = sev;

}  // 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().

                                                                              {

  context_.reset(supplier.clone());

}  // setContextSupplier()
void edm::service::ELadministrator::setExitThreshold ( const ELseverityLevel sev)

Definition at line 156 of file ELadministrator.cc.

References exitThreshold_.

                                                                     {

  exitThreshold_ = sev;

}  // setExitThreshold()
void edm::service::ELadministrator::setIntervals ( const ELstring id,
int  interval 
)

Definition at line 398 of file ELadministrator.cc.

References begin, and sinks().

                                                                       {

  std::list<boost::shared_ptr<ELdestination> >::iterator d;
  for ( d = sinks().begin();  d != sinks().end();  ++d )
    (*d)->limits.setInterval( id, interval );

}  // setIntervals()
void edm::service::ELadministrator::setIntervals ( const ELseverityLevel sev,
int  interval 
)

Definition at line 390 of file ELadministrator.cc.

References begin.

                                                                       {

  std::list<boost::shared_ptr<ELdestination> >::iterator d;
  for ( d = sinks().begin();  d != sinks().end();  ++d )
    (*d)->limits.setInterval( sev, interval );

}  // setIntervals()
void edm::service::ELadministrator::setLimits ( const ELstring id,
int  limit 
)

Definition at line 380 of file ELadministrator.cc.

References begin, and sinks().

                                                                 {

  std::list<boost::shared_ptr<ELdestination> >::iterator d;
  for ( d = sinks().begin();  d != sinks().end();  ++d )
    (*d)->limits.setLimit( id, limit );

}  // setLimits()
void edm::service::ELadministrator::setLimits ( const ELseverityLevel sev,
int  limit 
)

Definition at line 407 of file ELadministrator.cc.

References begin, and sinks().

                                                                         {

  std::list<boost::shared_ptr<ELdestination> >::iterator d;
  for ( d = sinks().begin();  d != sinks().end();  ++d )
    (*d)->limits.setLimit( sev, limit );

}  // setLimits()
void edm::service::ELadministrator::setProcess ( const ELstring process)

Definition at line 110 of file ELadministrator.cc.

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

                                                            {

  process_ = process;
  #if 0
    std::cerr << "Administrator process set to \"" << process << "\"\n";
  #endif

}  // setProcess()
void edm::service::ELadministrator::setThresholds ( const ELseverityLevel sev)

Definition at line 371 of file ELadministrator.cc.

References begin, and sinks().

                                                                  {

  std::list<boost::shared_ptr<ELdestination> >::iterator d;
  for ( d = sinks().begin();  d != sinks().end();  ++d )
    (*d)->threshold = sev;

}  // setThresholds()
void edm::service::ELadministrator::setTimespans ( const ELseverityLevel sev,
int  seconds 
)

Definition at line 425 of file ELadministrator.cc.

References begin, and sinks().

                                                                              {

  std::list<boost::shared_ptr<ELdestination> >::iterator d;
  for ( d = sinks().begin();  d != sinks().end();  ++d )
    (*d)->limits.setTimespan( sev, seconds );

}  // setTimespans()
void edm::service::ELadministrator::setTimespans ( const ELstring id,
int  seconds 
)

Definition at line 416 of file ELadministrator.cc.

References begin, and sinks().

                                                                      {

  std::list<boost::shared_ptr<ELdestination> >::iterator d;
  for ( d = sinks().begin();  d != sinks().end();  ++d )
    (*d)->limits.setTimespan( id, seconds );

}  // setTimespans()
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_.

          {

  int k = from.getLevel();
  int sum = severityCounts_[k];

  while ( ++k <= to.getLevel() )
    sum += severityCounts_[k];

  return  sum;

}  // severityCount()
int edm::service::ELadministrator::severityCount ( const ELseverityLevel sev) const

Definition at line 200 of file ELadministrator.cc.

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

                                                                       {

  return severityCounts_[sev.getLevel()];

}  // severityCount()
int edm::service::ELadministrator::severityCounts ( int  lev) const [protected]

Definition at line 272 of file ELadministrator.cc.

References severityCounts_.

                                                          {
  return severityCounts_[lev];
}
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().

                                                                  {
  ELcontextSupplier & save = *(context_);
  context_.reset(&cs);
  return save;
} // swapContextSupplier
ELstring edm::service::ELadministrator::swapProcess ( const ELstring process)

Definition at line 120 of file ELadministrator.cc.

References process(), process_, and cond::rpcobtemp::temp.

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

                                                                 {

  ELstring temp = process_;
  process_ = process;
  return temp;

} // swapProcess()
void edm::service::ELadministrator::wipe ( )

Definition at line 434 of file ELadministrator.cc.

References begin, and sinks().

                            {

  std::list<boost::shared_ptr<ELdestination> >::iterator d;
  for ( d = sinks().begin();  d != sinks().end();  ++d )
    (*d)->limits.wipe();

}  // wipe()

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

Definition at line 167 of file ELadministrator.h.

Referenced by abortThreshold(), and setAbortThreshold().

Definition at line 175 of file ELadministrator.h.

Referenced by attach(), and getELdestControl().

Definition at line 168 of file ELadministrator.h.

Referenced by exitThreshold(), and setExitThreshold().

Definition at line 161 of file ELadministrator.h.

Referenced by instance().

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().