| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Search for |

- File List
- File Members

# Auditor.h

Go to the documentation of this file.

    00001 // $Header: /local/reps/Gaudi/GaudiKernel/GaudiKernel/Auditor.h,v 1.16 2008/04/03 17:27:01 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 Auditor : virtual public IAuditor,
    00035                 virtual public IProperty {
    00036 public:
    00037
    00041   Auditor( const std::string& name, ISvcLocator *svcloc );
    00043   virtual ~Auditor();
    00044
    00048   StatusCode sysInitialize();
    00052   StatusCode sysFinalize();
    00053
    00055
    00056   virtual void before(StandardEventType, INamedInterface*);
    00057   virtual void before(StandardEventType, const std::string&);
    00058
    00059   virtual void before(CustomEventTypeRef, INamedInterface*);
    00060   virtual void before(CustomEventTypeRef, const std::string&);
    00061
    00062   virtual void after(StandardEventType, INamedInterface*, const StatusCode&);
    00063   virtual void after(StandardEventType, const std::string&, const StatusCode&);
    00064
    00065   virtual void after(CustomEventTypeRef, INamedInterface*, const StatusCode&);
    00066   virtual void after(CustomEventTypeRef, const std::string&, const StatusCode&);
    00067
    00068   // Obsolete methods
    00069
    00070   virtual void beforeInitialize(INamedInterface* ) ;
    00071   virtual void afterInitialize(INamedInterface* ) ;
    00072
    00073   virtual void beforeReinitialize(INamedInterface* ) ;
    00074   virtual void afterReinitialize(INamedInterface* ) ;
    00075
    00076   virtual void beforeExecute(INamedInterface* );
    00077   virtual void afterExecute(INamedInterface*, const StatusCode& );
    00078
    00079   virtual void beforeFinalize(INamedInterface* ) ;
    00080   virtual void afterFinalize(INamedInterface* ) ;
    00081
    00082   virtual void beforeBeginRun(INamedInterface* );
    00083   virtual void afterBeginRun(INamedInterface* );
    00084
    00085   virtual void beforeEndRun(INamedInterface* );
    00086   virtual void afterEndRun(INamedInterface* );
    00087
    00088   virtual StatusCode initialize();
    00089   virtual StatusCode finalize();
    00090
    00091   virtual const std::string&  name() const ;
    00092
    00093   virtual const bool isEnabled() const ;
    00094
    00098   IMessageSvc*  msgSvc() const;
    00099
    00101   int outputLevel() const { return m_outputLevel; }
    00102
    00104   void setOutputLevel( int level );
    00105
    00110   ISvcLocator* serviceLocator() const;
    00111
    00114   template <class T>
    00115   StatusCode service( const std::string& name, T*& svc, bool createIf = false ) const {
    00116     IService* theSvc;
    00117     StatusCode sc = serviceLocator()->getService( name, theSvc, createIf );
    00118     if ( sc.isSuccess() ) {
    00119       return theSvc->queryInterface(T::interfaceID(), (void**)&svc);
    00120     }
    00121     svc = 0;
    00122     return sc;
    00123   }
    00124
    00126   virtual StatusCode setProperty(const Property& p);
    00127
    00129   virtual StatusCode setProperty( const std::string& s );
    00130
    00132   virtual StatusCode setProperty( const std::string& n, const std::string& v);
    00133
    00135   virtual StatusCode getProperty(Property* p) const;
    00136
    00138   virtual const Property& getProperty( const std::string& name) const;
    00139
    00141   virtual StatusCode getProperty( const std::string& n, std::string& v ) const;
    00142
    00144   const std::vector<Property*>& getProperties( ) const;
    00145
    00146
    00187   template <class TYPE>
    00188   StatusCode setProperty
    00189   ( const std::string& name  ,
    00190     const TYPE&        value )
    00191   { return Gaudi::Utils::setProperty ( m_PropertyMgr , name , value ) ; }
    00192
    00198   StatusCode setProperties();
    00199
    00200   // ==========================================================================
    00228   template <class T>
    00229   Property* declareProperty( const std::string& name, T& property,
    00230                              const std::string& doc = "none") const {
    00231         return m_PropertyMgr->declareProperty(name, property, doc);
    00232   }
    00233
    00235   unsigned long addRef();
    00236   unsigned long release();
    00237   StatusCode queryInterface(const InterfaceID& riid, void**);
    00238
    00239  private:
    00240
    00241   long m_refCount;
    00242   std::string m_name;
    00243
    00244   IMessageSvc* m_MS;
    00245   ISvcLocator* m_pSvcLocator;
    00246   PropertyMgr* m_PropertyMgr;
    00247   int          m_outputLevel;
    00248   bool         m_isEnabled;
    00249   bool         m_isInitialized;
    00250   bool         m_isFinalized;
    00251
    00252   // Private Copy constructor: NO COPY ALLOWED
    00253   Auditor(const Auditor& a);
    00254
    00255   // Private asignment operator: NO ASSIGNMENT ALLOWED
    00256   Auditor& operator=(const Auditor& rhs);
    00257 };
    00258
    00259 #endif //GAUDIKERNEL_AUDITOR_H
    00260