| # Gaudi Framework, version v21r10p1 |

Home |  | Generated: 29 Jul 2010

# Auditor.h

Go to the documentation of this file.

    00001 // $Header: /tmp/svngaudi/tmp.jEpFh25751/Gaudi/GaudiKernel/GaudiKernel/Auditor.h,v 1.17 2008/10/27 19:22:20 marcocle Exp $
    00002 #ifndef GAUDIKERNEL_AUDITOR_H
    00003 #define GAUDIKERNEL_AUDITOR_H
    00004
    00005 // Include files
    00006 #include "GaudiKernel/IProperty.h"
    00007 #include "GaudiKernel/IAuditor.h"
    00008 #include "GaudiKernel/IService.h"
    00009 #include "GaudiKernel/ISvcLocator.h"  /*used by service(..)*/
    00010 #include "GaudiKernel/PropertyMgr.h"
    00011 #include <string>
    00012 #include <vector>
    00013
    00014 // Forward declarations
    00015 class IService;
    00016 class IMessageSvc;
    00017 class Property;
    00018 class Algorithm;
    00019
    00034 class GAUDI_API Auditor : public implements2<IAuditor, IProperty> {
    00035 public:
    00036
    00040   Auditor( const std::string& name, ISvcLocator *svcloc );
    00042   virtual ~Auditor();
    00043
    00047   StatusCode sysInitialize();
    00051   StatusCode sysFinalize();
    00052
    00054
    00055   virtual void before(StandardEventType, INamedInterface*);
    00056   virtual void before(StandardEventType, const std::string&);
    00057
    00058   virtual void before(CustomEventTypeRef, INamedInterface*);
    00059   virtual void before(CustomEventTypeRef, const std::string&);
    00060
    00061   virtual void after(StandardEventType, INamedInterface*, const StatusCode&);
    00062   virtual void after(StandardEventType, const std::string&, const StatusCode&);
    00063
    00064   virtual void after(CustomEventTypeRef, INamedInterface*, const StatusCode&);
    00065   virtual void after(CustomEventTypeRef, const std::string&, const StatusCode&);
    00066
    00067   // Obsolete methods
    00068
    00069   virtual void beforeInitialize(INamedInterface* ) ;
    00070   virtual void afterInitialize(INamedInterface* ) ;
    00071
    00072   virtual void beforeReinitialize(INamedInterface* ) ;
    00073   virtual void afterReinitialize(INamedInterface* ) ;
    00074
    00075   virtual void beforeExecute(INamedInterface* );
    00076   virtual void afterExecute(INamedInterface*, const StatusCode& );
    00077
    00078   virtual void beforeFinalize(INamedInterface* ) ;
    00079   virtual void afterFinalize(INamedInterface* ) ;
    00080
    00081   virtual void beforeBeginRun(INamedInterface* );
    00082   virtual void afterBeginRun(INamedInterface* );
    00083
    00084   virtual void beforeEndRun(INamedInterface* );
    00085   virtual void afterEndRun(INamedInterface* );
    00086
    00087   virtual StatusCode initialize();
    00088   virtual StatusCode finalize();
    00089
    00090   virtual const std::string&  name() const ;
    00091
    00092   virtual bool isEnabled() const ;
    00093
    00097   SmartIF<IMessageSvc>& msgSvc() const;
    00098
    00100   int outputLevel() const { return m_outputLevel; }
    00101
    00103   void setOutputLevel( int level );
    00104
    00109   SmartIF<ISvcLocator>& serviceLocator() const;
    00110
    00113   template <class T>
    00114   StatusCode service( const std::string& name, T*& svc, bool createIf = false ) const {
    00115     SmartIF<T> ptr(serviceLocator()->service(name, createIf));
    00116     if (ptr.isValid()) {
    00117       svc = ptr.get();
    00118       svc->addRef();
    00119       return StatusCode::SUCCESS;
    00120     }
    00121     // else
    00122     svc = 0;
    00123     return StatusCode::FAILURE;
    00124   }
    00125
    00127   virtual StatusCode setProperty(const Property& p);
    00128
    00130   virtual StatusCode setProperty( const std::string& s );
    00131
    00133   virtual StatusCode setProperty( const std::string& n, const std::string& v);
    00134
    00136   virtual StatusCode getProperty(Property* p) const;
    00137
    00139   virtual const Property& getProperty( const std::string& name) const;
    00140
    00142   virtual StatusCode getProperty( const std::string& n, std::string& v ) const;
    00143
    00145   const std::vector<Property*>& getProperties( ) const;
    00146
    00147
    00188   template <class TYPE>
    00189   StatusCode setProperty
    00190   ( const std::string& name  ,
    00191     const TYPE&        value )
    00192   { return Gaudi::Utils::setProperty ( m_PropertyMgr , name , value ) ; }
    00193
    00199   StatusCode setProperties();
    00200
    00201   // ==========================================================================
    00229   template <class T>
    00230   Property* declareProperty( const std::string& name, T& property,
    00231                              const std::string& doc = "none") const {
    00232         return m_PropertyMgr->declareProperty(name, property, doc);
    00233   }
    00234
    00235  private:
    00236
    00237   std::string m_name;
    00238
    00239   mutable SmartIF<IMessageSvc> m_MS;
    00240   mutable SmartIF<ISvcLocator> m_pSvcLocator;
    00241   PropertyMgr* m_PropertyMgr;
    00242   int          m_outputLevel;
    00243   bool         m_isEnabled;
    00244   bool         m_isInitialized;
    00245   bool         m_isFinalized;
    00246
    00247   // Private Copy constructor: NO COPY ALLOWED
    00248   Auditor(const Auditor& a);
    00249
    00250   // Private asignment operator: NO ASSIGNMENT ALLOWED
    00251   Auditor& operator=(const Auditor& rhs);
    00252 };
    00253
    00254 #endif //GAUDIKERNEL_AUDITOR_H
    00255