| # Gaudi Framework, version v23r1 |

Home |  | Generated: Wed Feb 29 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 ();
    00109
    00115   virtual StatusCode    finalize   ();
    00116
    00117 public: // accessors
    00118
    00122   INTupleSvc*          ntupleSvc () const;
    00123
    00127   INTupleSvc*          evtColSvc () const;
    00128
    00132   IDataProviderSvc*    detSvc    () const ;
    00133
    00137   IDataProviderSvc*    evtSvc    () const ;
    00138
    00142   IIncidentSvc*        incSvc    () const ;
    00143
    00147   IChronoStatSvc*      chronoSvc () const ;
    00148
    00152   IHistogramSvc*       histoSvc  () const ;
    00153
    00157   IAlgContextSvc*     contextSvc () const ;
    00158
    00159 public:
    00160
    00161   // following methods cannot go in GaudiCommon since they use methods ( evtSvc()
    00162   // and detDvc() ) that are not members of AlgTool.
    00163   // Also some methods seem which are members of the base class do not seem
    00164   // to be found unless forwarding methods are put here ??
    00165
    00196   inline DataObject* put ( IDataProviderSvc*  svc     ,
    00197                     DataObject*        object  ,
    00198                     const std::string& address ,
    00199                     const bool useRootInTES = true ) const
    00200   {
    00201     return GaudiCommon<AlgTool>::put ( svc , object , address , useRootInTES ) ;
    00202   }
    00203
    00232   inline DataObject* put ( DataObject*        object   ,
    00233                     const std::string& address  ,
    00234                     const bool useRootInTES = true ) const
    00235   {
    00236     return GaudiCommon<AlgTool>::put ( evtSvc() , object , address , useRootInTES ) ;
    00237   }
    00238
    00270   template < class TYPE  >
    00271   inline typename Gaudi::Utils::GetData<TYPE>::return_type
    00272   get  (  IDataProviderSvc*  svc       ,
    00273           const std::string& location  ,
    00274           const bool useRootInTES = true ) const
    00275   {
    00276     return GaudiCommon<AlgTool>::get<TYPE> ( svc , location , useRootInTES ) ;
    00277   }
    00278
    00304   template < class TYPE  >
    00305   inline typename Gaudi::Utils::GetData<TYPE>::return_type
    00306   get  ( const std::string& location  ,
    00307          const bool useRootInTES = true ) const
    00308   {
    00309     return GaudiCommon<AlgTool>::get<TYPE> ( evtSvc() , location , useRootInTES ) ;
    00310   }
    00311
    00330   template < class TYPE  >
    00331   inline TYPE* getDet ( IDataProviderSvc*  svc        ,
    00332                         const std::string& location   ) const
    00333   {
    00334     return GaudiCommon<AlgTool>::get<TYPE> ( svc , location , false ) ;
    00335   }
    00336
    00354   template < class TYPE  >
    00355   inline TYPE* getDet ( const std::string& location   ) const
    00356   {
    00357     return GaudiCommon<AlgTool>::get<TYPE> ( detSvc() , location , false ) ;
    00358   }
    00359
    00385   template < class TYPE  >
    00386   inline bool  exist    ( IDataProviderSvc*  svc      ,
    00387                           const std::string& location ,
    00388                           const bool useRootInTES = true ) const
    00389   {
    00390     return GaudiCommon<AlgTool>::exist<TYPE> ( svc , location , useRootInTES ) ;
    00391   }
    00392
    00415   template < class TYPE  >
    00416   inline bool  exist    ( const std::string& location ,
    00417                           const bool useRootInTES = true ) const
    00418   {
    00419     return GaudiCommon<AlgTool>::exist<TYPE> ( evtSvc() , location , useRootInTES ) ;
    00420   }
    00421
    00438   template < class TYPE  >
    00439   inline bool  existDet    ( IDataProviderSvc*  svc      ,
    00440                              const std::string& location ) const
    00441   {
    00442     return GaudiCommon<AlgTool>::exist<TYPE> ( svc , location , false ) ;
    00443   }
    00444
    00460   template < class TYPE  >
    00461   inline bool  existDet    ( const std::string& location ) const
    00462   {
    00463     return GaudiCommon<AlgTool>::exist<TYPE> ( detSvc() , location , false ) ;
    00464   }
    00465
    00492   template < class TYPE , class TYPE2 >
    00493   inline typename Gaudi::Utils::GetData<TYPE>::return_type
    00494   getOrCreate ( IDataProviderSvc*  svc                 ,
    00495                 const std::string& location            ,
    00496                 const bool         useRootInTES = true ) const
    00497   {
    00498     return GaudiCommon<AlgTool>::getOrCreate<TYPE,TYPE2> ( svc , location , useRootInTES ) ;
    00499   }
    00500
    00526   template < class TYPE , class TYPE2 >
    00527   inline typename Gaudi::Utils::GetData<TYPE>::return_type
    00528   getOrCreate ( const std::string& location            ,
    00529                 const bool         useRootInTES = true ) const
    00530   {
    00531     return GaudiCommon<AlgTool>::getOrCreate<TYPE,TYPE2> ( evtSvc() , location , useRootInTES ) ;
    00532   }
    00533
    00534 protected:
    00535
    00542   GaudiTool ( const std::string& type   ,
    00543               const std::string& name   ,
    00544               const IInterface*  parent );
    00545
    00547   virtual ~GaudiTool();
    00548
    00549 private:
    00550
    00552   GaudiTool();
    00553
    00555   GaudiTool             ( const GaudiTool& );
    00556
    00558   GaudiTool& operator = ( const GaudiTool& );
    00559
    00560 private:
    00561
    00563   mutable INTupleSvc*    m_ntupleSvc          ;
    00565   mutable INTupleSvc*    m_evtColSvc          ;
    00567   mutable IDataProviderSvc* m_evtSvc          ;
    00569   mutable IDataProviderSvc* m_detSvc          ;
    00571   mutable IChronoStatSvc*   m_chronoSvc       ;
    00573   mutable IIncidentSvc*     m_incSvc          ;
    00575   mutable IHistogramSvc *  m_histoSvc         ;
    00576   // Pointer to the Algorithm Context Service
    00577   mutable IAlgContextSvc* m_contextSvc     ;
    00578   // The name of the Algorithm Context Service
    00579   std::string             m_contextSvcName ;
    00580
    00581 private:
    00582
    00584   const std::string m_local ;
    00585
    00586 };
    00587 // ============================================================================
    00588
    00589 // ============================================================================
    00590 // The END
    00591 // ============================================================================
    00592 #endif  // GAUDIALG_GAUDITOOL_H
    00593 // ============================================================================
    00594
    00595

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines