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 ; } }
72 template <
class PBASE >
85 static const bool IgnoreRootInTES =
false;
97 static const bool UseRootInTES =
true;
104 typedef std::map<std::string,unsigned int>
Counter ;
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 ; }
514 void resetMsgStream()
const;
531 void msgLevelHandler (
Property& theProp );
564 template <
class CallerClass>
566 updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(
this),condition,mf);
598 template <
class CallerClass,
class CondType>
601 updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(
this),condition,mf,condPtrDest);
604 template <
class CallerClass>
606 updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(
this),std::string(condition),mf);
623 template <
class CallerClass,
class TargetClass>
625 updMgrSvc()->registerCondition(dynamic_cast<CallerClass*>(
this),condition,mf);
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; }
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 );
771 bool m_typePrint = true ;
773 bool m_propsPrint = false ;
775 bool m_statPrint = true ;
777 bool m_errorsPrint = true ;
788 double m_globalTimeOffset = 0;
800 #include "GaudiAlg/GaudiCommonImp.h"
806 #endif // GAUDIALG_GAUDICOMMON_H
bool operator()(const SmartIF< IService > &s, const std::string &n) const
Counter m_warnings
counter of warnings
AlgTools m_tools
List of active tools.
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...
Counter m_exceptions
Counter of exceptions.
std::map< std::string, unsigned int > Counter
the actual type error/warning counter
const std::string & rootInTES() const
Returns the "rootInTES" string.
std::unique_ptr< MsgStream > m_msgStream
The predefined message stream.
std::string m_rootOnTES
The rootOnTES string.
std::vector< IAlgTool * > AlgTools
storage for active tools
void registerCondition(TargetClass *condition, StatusCode(CallerClass::*mf)()=NULL)
register the current instance to the UpdateManagerSvc as a consumer for a condition.
Services m_services
List of active services.
bool operator()(const SmartIF< IService > &s, const SmartIF< IService > &n) const
SmartIF< ICounterSummarySvc > m_counterSummarySvc
a pointer to the CounterSummarySvc
Statistics m_counters
General counters.
Helper structure for implementation of "get"-functions for GaudiCommon
const std::string & context() const
Returns the "context" string. Used to identify different processing states.
const Statistics & counters() const
accessor to all counters
bool operator()(const std::string &n, const SmartIF< IService > &s) const
void registerCondition(char *condition, StatusCode(CallerClass::*mf)()=NULL)
just to avoid conflicts with the version using a pointer to a template class.
Data provider interface definition.
void registerCondition(const std::string &condition, StatusCode(CallerClass::*mf)()=nullptr)
register the current instance to the UpdateManagerSvc as a consumer for a condition.
const Services & services() const
get the list of aquired services
bool statPrint() const
Print statistical counters at finalization ?
bool m_useEffFormat
flag to use the special "efficiency" format
StatEntity & counter(const std::string &tag) const
accessor to certain counter by name
std::map< std::string, StatEntity > Statistics
the actual type of general counters
Counter m_errors
Counter of errors.
const AlgTools & tools() const
get the list of aquired tools
std::string m_format1
format for regular statistical printout rows
This class is used for returning status codes from appropriate routines.
std::string m_rootInTES
The rootInTES string.
bool propsPrint() const
Print properties at initialization ?
Definition of the basic interface.
Counter m_infos
counter of infos
bool errorsPrint() const
Print error counters at finalization ?
std::vector< SmartIF< IService > > Services
storage for active services
Interface class to the Update Manager service.
StatusCode runUpdate()
asks the UpdateManagerSvc to perform an update of the instance (if needed) without waiting the next B...
std::string m_header
the header row
constexpr const struct GaudiCommon_details::svc_eq_t svc_eq
bool typePrint() const
Insert the actual C++ type of the algorithm/tool in the messages ?
bool operator()(const SmartIF< IService > &s, const SmartIF< IService > &n) const
Base class from which all concrete algorithm classes should be derived.
Property base class allowing Property* collections to be "homogeneous".
std::string m_format2
format for "efficiency" statistical printout rows
void registerCondition(const std::string &condition, CondType *&condPtrDest, StatusCode(CallerClass::*mf)()=NULL)
register the current instance to the UpdateManagerSvc as a consumer for a condition.
Implements the common functionality between GaudiTools and GaudiAlgorithms.
bool operator()(const SmartIF< IService > &s, const std::string &n) const
double globalTimeOffset() const
Returns the "globalTimeOffset" double.
The basic counter used for Monitoring purposes.
std::string m_context
The context string.
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.