| # Gaudi Framework, version v20r3
Generated: 24 Nov 2008

# NameAuditor.cpp

Go to the documentation of this file.

    00001 // NameAuditor:
    00002 //  An auditor that prints the name of each algorithm method before
    00003 // and after it is called///
    00004
    00005 #include "NameAuditor.h"
    00006
    00007 #include "GaudiKernel/MsgStream.h"
    00008 #include "GaudiKernel/INamedInterface.h"
    00009 #include "GaudiKernel/AudFactory.h"
    00010
    00011 DECLARE_AUDITOR_FACTORY(NameAuditor);
    00012
    00013 NameAuditor::NameAuditor(const std::string& name, ISvcLocator* pSvcLocator) :
    00014   Auditor(name, pSvcLocator)
    00015 {
    00016
    00017   declareProperty("CustomEventTypes",m_types);
    00018
    00019 }
    00020
    00021 NameAuditor::~NameAuditor(){
    00022 }
    00023
    00024 void NameAuditor::beforeInitialize(INamedInterface* alg) {
    00025   MsgStream log(msgSvc(), name());
    00026   log << MSG::INFO << " About to Enter " << alg->name() <<
    00027   " Initialization Method" << endreq;
    00028 }
    00029 void NameAuditor:: afterInitialize(INamedInterface* alg){
    00030   MsgStream log(msgSvc(), name());
    00031   log << MSG::INFO << "Just Exited " << alg->name() <<
    00032   " Initialization Method" << endreq;
    00033 }
    00034
    00035 void NameAuditor::beforeReinitialize(INamedInterface *alg) {
    00036   MsgStream log(msgSvc(), name());
    00037   log << MSG::INFO << " About to Enter " << alg->name() <<
    00038   " Reinitialization Method" << endreq;
    00039 }
    00040 void NameAuditor:: afterReinitialize(INamedInterface *alg){
    00041   MsgStream log(msgSvc(), name());
    00042   log << MSG::INFO << "Just Exited " << alg->name() <<
    00043   " Reinitialization Method" << endreq;
    00044 }
    00045
    00046 void NameAuditor:: beforeExecute(INamedInterface* alg){
    00047   MsgStream log(msgSvc(), name());
    00048   log <<  MSG::INFO << "About to Enter " << alg->name() <<
    00049   " Execute Method" << endreq;
    00050 }
    00051 void NameAuditor:: afterExecute(INamedInterface* alg, const StatusCode& ) {
    00052   MsgStream log(msgSvc(), name());
    00053   log <<  MSG::INFO << "Just Exited " << alg->name() <<
    00054   " Execute Method" << endreq;
    00055 }
    00056
    00057 void NameAuditor::beforeBeginRun(INamedInterface *alg) {
    00058   MsgStream log(msgSvc(), name());
    00059   log << MSG::INFO << " About to Enter " << alg->name() <<
    00060   " BeginRun Method" << endreq;
    00061 }
    00062 void NameAuditor:: afterBeginRun(INamedInterface *alg){
    00063   MsgStream log(msgSvc(), name());
    00064   log << MSG::INFO << "Just Exited " << alg->name() <<
    00065   " BeginRun Method" << endreq;
    00066 }
    00067 void NameAuditor::beforeEndRun(INamedInterface *alg) {
    00068   MsgStream log(msgSvc(), name());
    00069   log << MSG::INFO << " About to Enter " << alg->name() <<
    00070   " EndRun Method" << endreq;
    00071 }
    00072 void NameAuditor:: afterEndRun(INamedInterface *alg){
    00073   MsgStream log(msgSvc(), name());
    00074   log << MSG::INFO << "Just Exited " << alg->name() <<
    00075   " EndRun Method" << endreq;
    00076 }
    00077
    00078 void NameAuditor:: beforeFinalize(INamedInterface* alg) {
    00079   MsgStream log(msgSvc(), name());
    00080   log <<  MSG::INFO << "About to Enter " << alg->name() <<
    00081   " Finalize Method" << endreq;
    00082 }
    00083 void NameAuditor:: afterFinalize(INamedInterface* alg){
    00084   MsgStream log(msgSvc(), name());
    00085   log << MSG::INFO << "Just Exited " << alg->name() <<
    00086   " Finalize Method" << endreq;
    00087 }
    00088
    00089 void
    00090 NameAuditor::before(CustomEventTypeRef evt, const std::string& caller) {
    00091
    00092   if (m_types.value().size() != 0) {
    00093     if ( (m_types.value())[0] == "none") {
    00094       return;
    00095     }
    00096
    00097     if ( find(m_types.value().begin(), m_types.value().end(), evt) ==
    00098          m_types.value().end() ) {
    00099       return;
    00100     }
    00101   }
    00102
    00103   MsgStream log( msgSvc(), name() );
    00104   log << MSG::INFO << "About to Enter " << caller << " with auditor trigger "
    00105       << evt << endreq;
    00106
    00107 }
    00108
    00109 void
    00110 NameAuditor::after(CustomEventTypeRef evt, const std::string& caller, const StatusCode&) {
    00111
    00112   if (m_types.value().size() != 0) {
    00113     if ( (m_types.value())[0] == "none") {
    00114       return;
    00115     }
    00116
    00117     if ( find(m_types.value().begin(), m_types.value().end(), evt) ==
    00118          m_types.value().end() ) {
    00119       return;
    00120     }
    00121   }
    00122
    00123   MsgStream log( msgSvc(), name() );
    00124   log << MSG::INFO << "Just Exited " << caller << " with auditor trigger "
    00125       << evt << endreq;
    00126
    00127 }