1 #ifndef GAUDIALG_GAUDICOMMON_H
2 #define GAUDIALG_GAUDICOMMON_H 1
15 #include "GaudiKernel/StatusCode.h"
16 #include "GaudiKernel/IMessageSvc.h"
17 #include "GaudiKernel/IToolSvc.h"
18 #include "GaudiKernel/IAlgTool.h"
19 #include "GaudiKernel/IAlgContextSvc.h"
20 #include "GaudiKernel/IDataProviderSvc.h"
21 #include "GaudiKernel/IAlgorithm.h"
22 #include "GaudiKernel/SmartDataPtr.h"
23 #include "GaudiKernel/System.h"
24 #include "GaudiKernel/GaudiException.h"
25 #include "GaudiKernel/IChronoStatSvc.h"
26 #include "GaudiKernel/StatEntity.h"
27 #include "GaudiKernel/ICounterSummarySvc.h"
28 #include "GaudiKernel/IUpdateManagerSvc.h"
29 #include "GaudiKernel/HashMap.h"
30 #include "GaudiKernel/CommonMessaging.h"
36 namespace Gaudi {
namespace Utils {
template <
class TYPE>
struct GetData ; } }
39 constexpr
const struct svc_eq_t {
44 constexpr
const struct svc_lt_t {
72 template <
class PBASE >
85 static const bool IgnoreRootInTES =
false;
97 static const bool UseRootInTES =
true;
102 typedef std::map<std::string,StatEntity> Statistics ;
104 typedef std::map<std::string,unsigned int> Counter ;
106 typedef std::vector<IAlgTool*> AlgTools ;
108 typedef std::vector<SmartIF<IService>> Services;
115 std::vector<std::string> m_counterList = std::vector<std::string>(1,
".*");
117 std::vector<std::string> m_statEntityList = std::vector<std::string>(0);
153 template <
class TYPE >
156 const std::string& location ,
157 const bool useRootInTES = true )
const ;
161 template <
class TYPE >
164 const std::string& location ,
165 const bool useRootInTES =
true )
const ;
192 template <
class TYPE >
194 const std::string& location ,
195 const bool useRootInTES =
true )
const ;
223 template <
class TYPE ,
class TYPE2 >
226 const std::string& location ,
227 const bool useRootInTES =
true )
const ;
255 const std::string& location ,
256 const bool useRootInTES =
true )
const ;
282 template <
class TOOL >
283 TOOL* tool (
const std::string&
type ,
284 const std::string&
name ,
286 bool create =
true )
const ;
309 template <
class TOOL >
310 TOOL* tool (
const std::string&
type ,
312 bool create =
true )
const ;
335 template <
class SERVICE >
337 const bool create =
true )
const ;
365 (
const std::string&
msg ,
367 const size_t mx = 10 )
const ;
392 (
const std::string&
msg ,
394 const size_t mx = 10 )
const ;
411 (
const std::string&
msg ,
413 const size_t mx = 10 )
const ;
426 (
const std::string&
msg ,
439 const std::string& message =
"" ,
451 const char* message ,
462 (
const std::string &
msg ,
475 (
const std::string & msg ,
476 const std::exception & exc ,
487 (
const std::string& msg =
"no message" ,
492 inline const Statistics& counters()
const {
return m_counters ; }
511 inline StatEntity& counter(
const std::string& tag )
const {
return m_counters[tag] ; }
514 void resetMsgStream()
const;
516 inline bool typePrint ()
const {
return m_typePrint ; }
518 inline bool propsPrint ()
const {
return m_propsPrint ; }
520 inline bool statPrint ()
const {
return m_statPrint ; }
522 inline bool errorsPrint ()
const {
return m_errorsPrint ; }
531 void msgLevelHandler (
Property& theProp );
564 template <
class CallerClass>
565 inline void registerCondition(
const std::string &condition,
StatusCode (CallerClass::*mf)() =
nullptr) {
566 updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(
this),condition,mf);
598 template <
class CallerClass,
class CondType>
599 inline void registerCondition(
const std::string &condition, CondType *&condPtrDest,
601 updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(
this),condition,mf,condPtrDest);
604 template <
class CallerClass>
605 inline void registerCondition(
char *condition,
StatusCode (CallerClass::*mf)() = NULL) {
606 updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(
this),std::string(condition),mf);
623 template <
class CallerClass,
class TargetClass>
624 inline void registerCondition(TargetClass *condition,
StatusCode (CallerClass::*mf)() = NULL) {
625 updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(
this),condition,mf);
638 inline StatusCode runUpdate() {
return updMgrSvc()->update(
this); }
645 const std::string&
name ,
653 {
return i_gcInitialize(); }
662 {
return i_gcFinalize(); }
700 using PBASE::release;
705 const AlgTools& tools ()
const {
return m_tools ; }
707 const Services& services ()
const {
return m_services ; }
712 void printErrorHandler (
Property& ) ;
714 void printPropsHandler (
Property& ) ;
716 void printStatHandler (
Property& ) ;
721 inline const std::string & context()
const {
return m_context; }
725 inline const std::string & rootInTES()
const {
return m_rootInTES; }
727 inline double globalTimeOffset()
const {
return m_globalTimeOffset; }
732 const std::string fullTESLocation
733 (
const std::string & location ,
734 const bool useRootInTES )
const ;
739 void addToToolList (
IAlgTool * tool )
const;
743 void initGaudiCommonConstructor(
const IInterface * parent = 0 );
752 mutable AlgTools m_tools ;
754 mutable Services m_services ;
757 mutable Counter m_errors ;
759 mutable Counter m_warnings ;
761 mutable Counter m_infos ;
763 mutable Counter m_exceptions ;
765 mutable Statistics m_counters ;
771 bool m_typePrint = true ;
773 bool m_propsPrint = false ;
775 bool m_statPrint = true ;
777 bool m_errorsPrint = true ;
780 std::string m_context;
782 std::string m_rootInTES;
786 std::string m_rootOnTES;
788 double m_globalTimeOffset = 0;
791 std::string m_header ;
793 std::string m_format1 ;
795 std::string m_format2 ;
797 bool m_useEffFormat ;
800 #include "GaudiAlg/GaudiCommonImp.h"
806 #endif // GAUDIALG_GAUDICOMMON_H
bool operator()(const std::string &n, const SmartIF< IService > &s) const
Define general base for Gaudi exception.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Helper structure for implementation of "get"-functions for GaudiCommon
bool operator()(const std::string &n, const SmartIF< IService > &s) const
Data provider interface definition.
This class is used for returning status codes from appropriate routines.
Definition of the basic interface.
Interface class to the Update Manager service.
std::unique_ptr< MsgStream > m_msgStream
The predefined message stream.
constexpr const struct GaudiCommon_details::svc_eq_t svc_eq
Base class from which all concrete algorithm classes should be derived.
Property base class allowing Property* collections to be "homogeneous".
Implements the common functionality between GaudiTools and GaudiAlgorithms.
The basic counter used for Monitoring purposes.
constexpr const struct GaudiCommon_details::svc_lt_t svc_lt
A DataObject is the base class of any identifiable object on any data store.
Helper functions to set/get the application return code.