Gaudi Framework, version v22r4

Home   Generated: Fri Sep 2 2011
Public Types | Public Member Functions | Private Member Functions | Private Attributes

AuditorSvc Class Reference

#include <AuditorSvc.h>

Inheritance diagram for AuditorSvc:
Inheritance graph
[legend]
Collaboration diagram for AuditorSvc:
Collaboration graph
[legend]

List of all members.

Public Types

typedef std::list< IAuditor * > ListAudits
typedef std::vector< std::stringVectorName

Public Member Functions

virtual StatusCode initialize ()
virtual StatusCode finalize ()
virtual void before (StandardEventType, INamedInterface *)
 The following methods are meant to be implemented by the child class...
virtual void before (StandardEventType, const std::string &)
 Audit the start of a standard "event" for callers that do not implement INamedInterface.
virtual void before (CustomEventTypeRef, INamedInterface *)
 Audit the start of a custom "event".
virtual void before (CustomEventTypeRef, const std::string &)
 Audit the start of a custom "event" for callers that do not implement INamedInterface.
virtual void after (StandardEventType, INamedInterface *, const StatusCode &)
 Audit the end of a standard "event".
virtual void after (StandardEventType, const std::string &, const StatusCode &)
 Audit the end of a standard "event" for callers that do not implement INamedInterface.
virtual void after (CustomEventTypeRef, INamedInterface *, const StatusCode &)
 Audit the end of a custom "event".
virtual void after (CustomEventTypeRef, const std::string &, const StatusCode &)
 Audit the end of a custom "event" for callers that do not implement INamedInterface.
virtual void beforeInitialize (INamedInterface *ini)
virtual void afterInitialize (INamedInterface *ini)
virtual void beforeReinitialize (INamedInterface *ini)
virtual void afterReinitialize (INamedInterface *ini)
virtual void beforeExecute (INamedInterface *ini)
virtual void afterExecute (INamedInterface *ini, const StatusCode &)
virtual void beforeBeginRun (INamedInterface *ini)
virtual void afterBeginRun (INamedInterface *ini)
virtual void beforeEndRun (INamedInterface *ini)
virtual void afterEndRun (INamedInterface *ini)
virtual void beforeFinalize (INamedInterface *ini)
virtual void afterFinalize (INamedInterface *ini)
virtual bool isEnabled () const
 Tell if the auditor is enabled or not.
virtual StatusCode sysInitialize ()
 Initialize Service.
virtual StatusCode sysFinalize ()
 Finalize Service.
virtual IAuditorgetAuditor (const std::string &name)
 management functionality: retrieve an Auditor
 AuditorSvc (const std::string &name, ISvcLocator *svc)
virtual ~AuditorSvc ()

Private Member Functions

IAuditornewAuditor_ (MsgStream &, const std::string &)
IAuditorfindAuditor_ (const std::string &)
StatusCode syncAuditors_ ()

Private Attributes

VectorName m_audNameList
ListAudits m_pAudList
bool m_isEnabled

Detailed Description

Definition at line 19 of file AuditorSvc.h.


Member Typedef Documentation

Definition at line 24 of file AuditorSvc.h.

Definition at line 25 of file AuditorSvc.h.


Constructor & Destructor Documentation

AuditorSvc::AuditorSvc ( const std::string name,
ISvcLocator svc 
)

Definition at line 99 of file AuditorSvc.cpp.

: base_class(name, svc) {
  declareProperty("Auditors", m_audNameList );
  declareProperty("Enable", m_isEnabled = true);
  m_pAudList.clear();
}
AuditorSvc::~AuditorSvc (  ) [virtual]

Definition at line 107 of file AuditorSvc.cpp.

                        {
}

Member Function Documentation

void AuditorSvc::after ( StandardEventType  ,
INamedInterface ,
const StatusCode sc 
) [virtual]

Audit the end of a standard "event".

Implements IAuditor.

Definition at line 177 of file AuditorSvc.cpp.

                                                                                        {
  if (!isEnabled()) return;
  for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) {
    if((*it)->isEnabled()) {
      (*it)->after(evt,obj,sc);
    }
  }
}
void AuditorSvc::after ( StandardEventType  ,
const std::string ,
const StatusCode sc 
) [virtual]

Audit the end of a standard "event" for callers that do not implement INamedInterface.

Implements IAuditor.

Definition at line 186 of file AuditorSvc.cpp.

                                                                                         {
  if (!isEnabled()) return;
  for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) {
    if((*it)->isEnabled()) {
      (*it)->after(evt,name,sc);
    }
  }
}
void AuditorSvc::after ( CustomEventTypeRef  ,
INamedInterface ,
const StatusCode sc 
) [virtual]

Audit the end of a custom "event".

Implements IAuditor.

Definition at line 195 of file AuditorSvc.cpp.

                                                                                         {
  if (!isEnabled()) return;
  for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) {
    if((*it)->isEnabled()) {
      (*it)->after(evt,obj,sc);
    }
  }
}
void AuditorSvc::after ( CustomEventTypeRef  ,
const std::string ,
const StatusCode sc 
) [virtual]

Audit the end of a custom "event" for callers that do not implement INamedInterface.

Implements IAuditor.

Definition at line 204 of file AuditorSvc.cpp.

                                                                                          {
  if (!isEnabled()) return;
  for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) {
    if((*it)->isEnabled()) {
      (*it)->after(evt,name,sc);
    }
  }
}
virtual void AuditorSvc::afterBeginRun ( INamedInterface  ) [virtual]
Deprecated:
use after

Implements IAuditor.

virtual void AuditorSvc::afterEndRun ( INamedInterface  ) [virtual]
Deprecated:
use after

Implements IAuditor.

void AuditorSvc::afterExecute ( INamedInterface ,
const StatusCode  
) [virtual]
Deprecated:
use after

Implements IAuditor.

Definition at line 227 of file AuditorSvc.cpp.

                                                                {
  throw GaudiException("The method afterExecute is obsolete do not call it.",
                       "AuditorSvc::afterExecute" , StatusCode::FAILURE);
}
virtual void AuditorSvc::afterFinalize ( INamedInterface  ) [virtual]
Deprecated:
use after

Implements IAuditor.

virtual void AuditorSvc::afterInitialize ( INamedInterface  ) [virtual]
Deprecated:
use after

Implements IAuditor.

virtual void AuditorSvc::afterReinitialize ( INamedInterface  ) [virtual]
Deprecated:
use after

Implements IAuditor.

void AuditorSvc::before ( StandardEventType  ,
const std::string  
) [virtual]

Audit the start of a standard "event" for callers that do not implement INamedInterface.

Implements IAuditor.

Definition at line 149 of file AuditorSvc.cpp.

                                                                    {
  if (!isEnabled()) return;
  for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) {
    if((*it)->isEnabled()) {
      (*it)->before(evt,name);
    }
  }
}
void AuditorSvc::before ( CustomEventTypeRef  ,
INamedInterface  
) [virtual]

Audit the start of a custom "event".

Implements IAuditor.

Definition at line 158 of file AuditorSvc.cpp.

                                                                    {
  if (!isEnabled()) return;
  for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) {
    if((*it)->isEnabled()) {
      (*it)->before(evt,obj);
    }
  }
}
void AuditorSvc::before ( StandardEventType  evt,
INamedInterface obj 
) [virtual]

The following methods are meant to be implemented by the child class...

Implements IAuditor.

Definition at line 140 of file AuditorSvc.cpp.

                                                                   {
  if (!isEnabled()) return;
  for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) {
    if((*it)->isEnabled()) {
      (*it)->before(evt,obj);
    }
  }
}
void AuditorSvc::before ( CustomEventTypeRef  ,
const std::string  
) [virtual]

Audit the start of a custom "event" for callers that do not implement INamedInterface.

Implements IAuditor.

Definition at line 167 of file AuditorSvc.cpp.

                                                                     {
  if (!isEnabled()) return;
  for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) {
    if((*it)->isEnabled()) {
      (*it)->before(evt,name);
    }
  }
}
virtual void AuditorSvc::beforeBeginRun ( INamedInterface  ) [virtual]
Deprecated:
use before

Implements IAuditor.

virtual void AuditorSvc::beforeEndRun ( INamedInterface  ) [virtual]
Deprecated:
use before

Implements IAuditor.

virtual void AuditorSvc::beforeExecute ( INamedInterface  ) [virtual]
Deprecated:
use before

Implements IAuditor.

virtual void AuditorSvc::beforeFinalize ( INamedInterface  ) [virtual]
Deprecated:
use before

Implements IAuditor.

virtual void AuditorSvc::beforeInitialize ( INamedInterface  ) [virtual]
Deprecated:
use before

Implements IAuditor.

virtual void AuditorSvc::beforeReinitialize ( INamedInterface  ) [virtual]
Deprecated:
use before

Implements IAuditor.

StatusCode AuditorSvc::finalize ( void   ) [virtual]

Reimplemented from Service.

Definition at line 125 of file AuditorSvc.cpp.

                                {

  for (ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); it++) {
    if((*it)->isEnabled()) {
       (*it)->sysFinalize().ignore();
    }
    (*it)->release();
  }
  m_pAudList.clear();

  // Finalize this specific service
  return Service::finalize();
}
IAuditor * AuditorSvc::findAuditor_ ( const std::string name ) [private]

Definition at line 49 of file AuditorSvc.cpp.

                                                          {
  // find an auditor by name, return 0 on error
  IAuditor* aud = 0;
  const std::string item_name = Gaudi::Utils::TypeNameString(name).name();
  for ( ListAudits::iterator it = m_pAudList.begin() ; it != m_pAudList.end(); ++it ) {
    if ( (*it)->name() == item_name ) {
      (*it)->addRef();
      aud = *it;
      break;
    }
  }

  return aud;
}
IAuditor * AuditorSvc::getAuditor ( const std::string name ) [virtual]

management functionality: retrieve an Auditor

Implements IAuditorSvc.

Definition at line 254 of file AuditorSvc.cpp.

                                                        {
  // by interactively setting properties, auditors might be out of sync
  if ( !syncAuditors_().isSuccess() ) {
    // as we didn't manage to sync auditors, the safest bet is to assume the
    // worse...
    // So don't let clients play with an AuditorSvc in an inconsistent state
    return 0;
  }

  // search available auditors, returns 0 on error
  return findAuditor_( name );
}
StatusCode AuditorSvc::initialize ( void   ) [virtual]

Reimplemented from Service.

Definition at line 113 of file AuditorSvc.cpp.

                                  {
  StatusCode sc = Service::initialize();
  if ( sc.isFailure() )
    return sc;

  // create auditor objects for all named auditors
  sc = syncAuditors_();

  return sc;
}
bool AuditorSvc::isEnabled (  ) const [virtual]

Tell if the auditor is enabled or not.

Implements IAuditor.

Definition at line 242 of file AuditorSvc.cpp.

                                  {
  return m_isEnabled;
}
IAuditor * AuditorSvc::newAuditor_ ( MsgStream log,
const std::string name 
) [private]

Definition at line 25 of file AuditorSvc.cpp.

                                                                         {
  // locate the auditor factory, instantiate a new auditor, initialize it
  IAuditor* aud = 0;
  StatusCode sc;
  Gaudi::Utils::TypeNameString item(name) ;
  aud = PluginService::Create<IAuditor*>( item.type(), item.name(), serviceLocator().get() );
  if ( aud ) {
    aud->addRef();
    if ( m_targetState >= Gaudi::StateMachine::INITIALIZED ) {
      sc = aud->sysInitialize();
      if ( sc.isFailure() ) {
        log << MSG::WARNING << "Failed to initialize Auditor " << name << endmsg;
        aud->release();
        aud = 0;
      }
    }
  }
  else {
    log << MSG::WARNING << "Unable to retrieve factory for Auditor " << name << endmsg;
  }

  return aud;
}
StatusCode AuditorSvc::syncAuditors_ (  ) [private]

Definition at line 64 of file AuditorSvc.cpp.

                                     {
  if ( m_audNameList.size() == m_pAudList.size() )
    return StatusCode::SUCCESS;

  MsgStream log( msgSvc(), name() );
  StatusCode sc;

//   if ( sc.isFailure() ) {
//     log << MSG::ERROR << "Unable to locate ObjectManager Service" << endmsg;
//     return sc;
//   }

  // create all declared Auditors that do not yet exist
  for ( VectorName::iterator it = m_audNameList.begin(); it != m_audNameList.end(); it++ ) {

    // this is clumsy, but the PropertyMgr won't tell us when my property changes right
    // under my nose, so I'll have to figure this out the hard way
    if ( !findAuditor_( *it ) ) { // if auditor does not yet exist
      IAuditor* aud = newAuditor_( log, *it );

      if ( aud != 0 ) {
        m_pAudList.push_back( aud );
      }
      else {
        log << MSG::ERROR << "Error constructing Auditor " << *it << endmsg;
        sc = StatusCode::FAILURE;
      }
    }
  }
  return sc;
}
StatusCode AuditorSvc::sysFinalize (  ) [virtual]

Finalize Service.

Reimplemented from Service.

Definition at line 249 of file AuditorSvc.cpp.

                                  {
  return Service::sysFinalize();
}
StatusCode AuditorSvc::sysInitialize (  ) [virtual]

Initialize Service.

Reimplemented from Service.

Definition at line 246 of file AuditorSvc.cpp.

                                    {
  return Service::sysInitialize();
}

Member Data Documentation

Definition at line 104 of file AuditorSvc.h.

Definition at line 110 of file AuditorSvc.h.

Definition at line 107 of file AuditorSvc.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Fri Sep 2 2011 16:25:15 for Gaudi Framework, version v22r4 by Doxygen version 1.7.2 written by Dimitri van Heesch, © 1997-2004