Gaudi Framework, version v23r3

Home   Generated: Thu Jun 28 2012

GaudiTool.h

Go to the documentation of this file.
00001 // $Id: GaudiTool.h,v 1.13 2008/10/10 13:38:28 marcocle Exp $
00002 // ============================================================================
00003 #ifndef GAUDIALG_GAUDITOOL_H
00004 #define GAUDIALG_GAUDITOOL_H 1
00005 // ============================================================================
00006 // Include files
00007 // ============================================================================
00008 // GaudiKernel
00009 // ============================================================================
00010 #include "GaudiKernel/AlgTool.h"
00011 #include "GaudiKernel/DataObject.h"
00012 // ============================================================================
00013 // GaudiAlg
00014 // ============================================================================
00015 #include "GaudiAlg/GaudiAlg.h"
00016 #include "GaudiAlg/GaudiCommon.h"
00017 // ============================================================================
00018 // forward declarations
00019 // ============================================================================
00020 class          IDataProviderSvc ;
00021 class          IChronoStatSvc   ;
00022 class          IIncidentSvc     ;
00023 class          IHistogramSvc    ;
00024 class          GaudiException   ;
00025 class          INTupleSvc       ;
00026 class          IAlgContextSvc   ;
00027 namespace std { class exception ; }
00028 // ============================================================================
00064 // ============================================================================
00098 // ============================================================================
00099 class GAUDI_API GaudiTool: public GaudiCommon<AlgTool>
00100 {
00101 public:
00102   // ==========================================================================
00108   virtual StatusCode    initialize ();
00114   virtual StatusCode    finalize   ();
00115   // ==========================================================================
00116 public: // accessors
00117   // ==========================================================================
00121   INTupleSvc*          ntupleSvc () const;
00125   INTupleSvc*          evtColSvc () const;
00129   IDataProviderSvc*    detSvc    () const ;
00133   IDataProviderSvc*    evtSvc    () const ;
00137   IIncidentSvc*        incSvc    () const ;
00141   IChronoStatSvc*      chronoSvc () const ;
00145   IHistogramSvc*       histoSvc  () const ;
00149   IAlgContextSvc*     contextSvc () const ;
00150   // ==========================================================================
00151 public:
00152   // ==========================================================================
00153   // following methods cannot go in GaudiCommon since they use methods ( evtSvc()
00154   // and detDvc() ) that are not members of AlgTool.
00155   // Also some methods seem which are members of the base class do not seem
00156   // to be found unless forwarding methods are put here ??
00157   // ==========================================================================
00188   inline DataObject* put ( IDataProviderSvc*  svc     ,
00189                     DataObject*        object  ,
00190                     const std::string& address ,
00191                     const bool useRootInTES = true ) const
00192   {
00193     return GaudiCommon<AlgTool>::put ( svc , object , address , useRootInTES ) ;
00194   }
00223   inline DataObject* put ( DataObject*        object   ,
00224                     const std::string& address  ,
00225                     const bool useRootInTES = true ) const
00226   {
00227     return GaudiCommon<AlgTool>::put ( evtSvc() , object , address , useRootInTES ) ;
00228   }
00260   template < class TYPE  >
00261   inline typename Gaudi::Utils::GetData<TYPE>::return_type
00262   get  (  IDataProviderSvc*  svc       ,
00263           const std::string& location  ,
00264           const bool useRootInTES = true ) const
00265   {
00266     return GaudiCommon<AlgTool>::get<TYPE> ( svc , location , useRootInTES ) ;
00267   }
00293   template < class TYPE  >
00294   inline typename Gaudi::Utils::GetData<TYPE>::return_type
00295   get  ( const std::string& location  ,
00296          const bool useRootInTES = true ) const
00297   {
00298     return GaudiCommon<AlgTool>::get<TYPE> ( evtSvc() , location , useRootInTES ) ;
00299   }
00318   template < class TYPE  >
00319   inline TYPE* getDet ( IDataProviderSvc*  svc        ,
00320                         const std::string& location   ) const
00321   {
00322     return GaudiCommon<AlgTool>::get<TYPE> ( svc , location , false ) ;
00323   }
00341   template < class TYPE  >
00342   inline TYPE* getDet ( const std::string& location   ) const
00343   {
00344     return GaudiCommon<AlgTool>::get<TYPE> ( detSvc() , location , false ) ;
00345   }
00371   template < class TYPE  >
00372   inline bool  exist    ( IDataProviderSvc*  svc      ,
00373                           const std::string& location ,
00374                           const bool useRootInTES = true ) const
00375   {
00376     return GaudiCommon<AlgTool>::exist<TYPE> ( svc , location , useRootInTES ) ;
00377   }
00400   template < class TYPE  >
00401   inline bool  exist    ( const std::string& location ,
00402                           const bool useRootInTES = true ) const
00403   {
00404     return GaudiCommon<AlgTool>::exist<TYPE> ( evtSvc() , location , useRootInTES ) ;
00405   }
00422   template < class TYPE  >
00423   inline bool  existDet    ( IDataProviderSvc*  svc      ,
00424                              const std::string& location ) const
00425   {
00426     return GaudiCommon<AlgTool>::exist<TYPE> ( svc , location , false ) ;
00427   }
00443   template < class TYPE  >
00444   inline bool  existDet    ( const std::string& location ) const
00445   {
00446     return GaudiCommon<AlgTool>::exist<TYPE> ( detSvc() , location , false ) ;
00447   }
00474   template < class TYPE , class TYPE2 >
00475   inline typename Gaudi::Utils::GetData<TYPE>::return_type
00476   getOrCreate ( IDataProviderSvc*  svc                 ,
00477                 const std::string& location            ,
00478                 const bool         useRootInTES = true ) const
00479   {
00480     return GaudiCommon<AlgTool>::getOrCreate<TYPE,TYPE2> ( svc , location , useRootInTES ) ;
00481   }
00507   template < class TYPE , class TYPE2 >
00508   inline typename Gaudi::Utils::GetData<TYPE>::return_type
00509   getOrCreate ( const std::string& location            ,
00510                 const bool         useRootInTES = true ) const
00511   {
00512     return GaudiCommon<AlgTool>::getOrCreate<TYPE,TYPE2> ( evtSvc() , location , useRootInTES ) ;
00513   }
00514   // ==========================================================================
00515 public:
00516   // ==========================================================================
00518   static bool enableSummary  ( bool ) ;               // enable/disable summary
00520   static bool summaryEnabled (      ) ;               // is summary enabled?
00521   // ==========================================================================
00522 protected:
00523   // ==========================================================================
00530   GaudiTool ( const std::string& type   ,
00531               const std::string& name   ,
00532               const IInterface*  parent );
00533 
00535   virtual ~GaudiTool();
00536   // ==========================================================================
00537 private:
00538   // ==========================================================================
00540   GaudiTool();
00542   GaudiTool             ( const GaudiTool& );
00544   GaudiTool& operator = ( const GaudiTool& );
00545   // ==========================================================================
00546 private:
00547   // ==========================================================================
00549   mutable INTupleSvc*    m_ntupleSvc          ;
00551   mutable INTupleSvc*    m_evtColSvc          ;
00553   mutable IDataProviderSvc* m_evtSvc          ;
00555   mutable IDataProviderSvc* m_detSvc          ;
00557   mutable IChronoStatSvc*   m_chronoSvc       ;
00559   mutable IIncidentSvc*     m_incSvc          ;
00561   mutable IHistogramSvc *  m_histoSvc         ;
00562   // Pointer to the Algorithm Context Service
00563   mutable IAlgContextSvc* m_contextSvc     ; 
00564   // The name of the Algorithm Context Service
00565   std::string             m_contextSvcName ; 
00566   // ==========================================================================
00567 private:
00568   // ==========================================================================
00570   const std::string m_local ;
00571   // ==========================================================================
00572 private:
00573   // ==========================================================================
00575   static bool s_enableSummary ;  // enable printout of summary?
00576   // ==========================================================================
00577 };
00578 // ============================================================================
00579 
00580 // ============================================================================
00581 // The END
00582 // ============================================================================
00583 #endif  // GAUDIALG_GAUDITOOL_H
00584 // ============================================================================
00585 
00586 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated at Thu Jun 28 2012 12:29:51 for Gaudi Framework, version v23r3 by Doxygen version 1.7.2 written by Dimitri van Heesch, © 1997-2004