The Gaudi Framework  v36r10 (fc05264c)
Gaudi::Monitoring::BaseSink Class Reference

Base class for all Sinks registering to the Monitoring Hub. More...

#include </builds/gaudi/Gaudi/GaudiKernel/include/Gaudi/BaseSink.h>

Inheritance diagram for Gaudi::Monitoring::BaseSink:
Collaboration diagram for Gaudi::Monitoring::BaseSink:

Public Member Functions

StatusCode initialize () override
 
void registerEntity (Hub::Entity ent) override
 handles registration of a new entity More...
 
void removeEntity (Hub::Entity const &ent) override
 handles removal of an entity More...
 
 Service (std::string name, ISvcLocator *svcloc)
 Standard Constructor
More...
 
- Public Member Functions inherited from Service
const std::stringname () const override
 Retrieve name of the service
More...
 
StatusCode configure () override
 
StatusCode initialize () override
 
StatusCode start () override
 
StatusCode stop () override
 
StatusCode finalize () override
 
StatusCode terminate () override
 
Gaudi::StateMachine::State FSMState () const override
 
Gaudi::StateMachine::State targetFSMState () const override
 
StatusCode reinitialize () override
 
StatusCode restart () override
 
StatusCode sysInitialize () override
 Initialize Service
More...
 
StatusCode sysStart () override
 Initialize Service
More...
 
StatusCode sysStop () override
 Initialize Service
More...
 
StatusCode sysFinalize () override
 Finalize Service
More...
 
StatusCode sysReinitialize () override
 Re-initialize the Service. More...
 
StatusCode sysRestart () override
 Re-initialize the Service. More...
 
 Service (std::string name, ISvcLocator *svcloc)
 Standard Constructor
More...
 
SmartIF< ISvcLocator > & serviceLocator () const override
 Retrieve pointer to service locator
More...
 
template<class T >
StatusCode service (const std::string &name, const T *&psvc, bool createIf=true) const
 Access a service by name, creating it if it doesn't already exist. More...
 
template<class T >
StatusCode service (const std::string &name, T *&psvc, bool createIf=true) const
 
template<typename IFace = IService>
SmartIF< IFace > service (const std::string &name, bool createIf=true) const
 
template<class T >
StatusCode service (const std::string &svcType, const std::string &svcName, T *&psvc) const
 Access a service by name and type, creating it if it doesn't already exist. More...
 
template<class T >
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandle< T > &hndl, const std::string &doc="none")
 
template<class T >
StatusCode declareTool (ToolHandle< T > &handle, bool createIf=true)
 
template<class T >
StatusCode declareTool (ToolHandle< T > &handle, std::string toolTypeAndName, bool createIf=true)
 Declare used tool. More...
 
template<class T >
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, ToolHandleArray< T > &hndlArr, const std::string &doc="none")
 
template<class T >
void addToolsArray (ToolHandleArray< T > &hndlArr)
 
const std::vector< IAlgTool * > & tools () const
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
 
- Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
 PropertyHolder ()=default
 
Gaudi::Details::PropertyBasedeclareProperty (Gaudi::Details::PropertyBase &prop)
 Declare a property. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
 Helper to wrap a regular data member and use it as a regular property. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
 Declare a PropertyBase instance setting name and documentation. More...
 
Gaudi::Details::PropertyBasedeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
 Declare a remote property. More...
 
StatusCode setProperty (const std::string &name, const Gaudi::Details::PropertyBase &p) override
 set the property from another property with a different name More...
 
StatusCode setProperty (const std::string &s) override
 set the property from the formatted string More...
 
StatusCode setProperty (const Gaudi::Details::PropertyBase &p)
 Set the property from a property. More...
 
virtual StatusCode setProperty (const std::string &name, const Gaudi::Details::PropertyBase &p)=0
 Set the property from a property with a different name. More...
 
virtual StatusCode setProperty (const std::string &s)=0
 Set the property by string. More...
 
StatusCode setProperty (const std::string &name, const char *v)
 Special case for string literals. More...
 
StatusCode setProperty (const std::string &name, const std::string &v)
 Special case for std::string. More...
 
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
StatusCode setPropertyRepr (const std::string &n, const std::string &r) override
 set the property from name and value string representation More...
 
StatusCode getProperty (Gaudi::Details::PropertyBase *p) const override
 get the property More...
 
const Gaudi::Details::PropertyBasegetProperty (std::string_view name) const override
 get the property by name More...
 
StatusCode getProperty (std::string_view n, std::string &v) const override
 convert the property to the string More...
 
const std::vector< Gaudi::Details::PropertyBase * > & getProperties () const override
 get all properties More...
 
bool hasProperty (std::string_view name) const override
 Return true if we have a property with the given name. More...
 
Gaudi::Details::PropertyBaseproperty (std::string_view name) const
 \fixme property and bindPropertiesTo should be protected More...
 
void bindPropertiesTo (Gaudi::Interfaces::IOptionsSvc &optsSvc)
 
 PropertyHolder (const PropertyHolder &)=delete
 
PropertyHolderoperator= (const PropertyHolder &)=delete
 
- Public Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level msgLevel () const
 get the cached level (originally extracted from the embedded MsgStream) More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
- Public Member Functions inherited from Gaudi::Monitoring::Hub::Sink
virtual ~Sink ()=default
 

Protected Member Functions

template<typename Callable >
void applytoAllEntities (Callable func, bool sortFirst=false)
 applies a callable to all monitoring entities More...
 
- Protected Member Functions inherited from Service
std::vector< IAlgTool * > & tools ()
 
 ~Service () override
 Standard Destructor
More...
 
int outputLevel () const
 get the Service's output level More...
 
- Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level setUpMessaging () const
 Set up local caches. More...
 
MSG::Level resetMessaging ()
 Reinitialize internal states. More...
 
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 

Private Member Functions

bool wanted (std::string name, std::vector< std::string > searchNames)
 deciding whether a given name matches the list of regexps given empty list means everything matches More...
 

Private Attributes

std::deque< Gaudi::Monitoring::Hub::Entitym_monitoringEntities
 list of entities we are dealing with More...
 
Gaudi::Property< std::vector< std::string > > m_namesToSave
 
Gaudi::Property< std::vector< std::string > > m_componentsToSave
 
Gaudi::Property< std::vector< std::string > > m_typesToSave
 

Additional Inherited Members

- Public Types inherited from Service
using Factory = Gaudi::PluginService::Factory< IService *(const std::string &, ISvcLocator *)>
 
- Public Types inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
using PropertyHolderImpl = PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
 Typedef used to refer to this class from derived classes, as in. More...
 
- Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using base_class = CommonMessaging
 
- Protected Attributes inherited from Service
Gaudi::StateMachine::State m_state = Gaudi::StateMachine::OFFLINE
 Service state
More...
 
Gaudi::StateMachine::State m_targetState = Gaudi::StateMachine::OFFLINE
 Service state
More...
 
Gaudi::Property< int > m_outputLevel { this, "OutputLevel", MSG::NIL, "output level" }
 flag indicating whether ToolHandle tools have been added to m_tools More...
 
Gaudi::Property< bool > m_auditInit { this, "AuditServices", false, "[[deprecated]] unused" }
 
Gaudi::Property< bool > m_auditorInitialize { this, "AuditInitialize", false, "trigger auditor on initialize()" }
 
Gaudi::Property< bool > m_auditorStart { this, "AuditStart", false, "trigger auditor on start()" }
 
Gaudi::Property< bool > m_auditorStop { this, "AuditStop", false, "trigger auditor on stop()" }
 
Gaudi::Property< bool > m_auditorFinalize { this, "AuditFinalize", false, "trigger auditor on finalize()" }
 
Gaudi::Property< bool > m_auditorReinitialize { this, "AuditReinitialize", false, "trigger auditor on reinitialize()" }
 
Gaudi::Property< bool > m_auditorRestart { this, "AuditRestart", false, "trigger auditor on restart()" }
 
Gaudi::Property< bool > m_autoRetrieveTools
 
Gaudi::Property< bool > m_checkToolDeps
 
SmartIF< IAuditorSvcm_pAuditorSvc
 Auditor Service
More...
 

Detailed Description

Base class for all Sinks registering to the Monitoring Hub.

Deals with registration and manages selection of Entities Should be extended by actual Sinks

Definition at line 27 of file BaseSink.h.

Member Function Documentation

◆ applytoAllEntities()

template<typename Callable >
void Gaudi::Monitoring::BaseSink::applytoAllEntities ( Callable  func,
bool  sortFirst = false 
)
inlineprotected

applies a callable to all monitoring entities

Entities may be first sorted to improve reproducibility

Definition at line 58 of file BaseSink.h.

58  {
59  // sort if required
60  if ( sortFirst ) {
61  std::sort( begin( m_monitoringEntities ), end( m_monitoringEntities ), []( const auto& a, const auto& b ) {
62  return std::tie( a.name, a.component ) > std::tie( b.name, b.component );
63  } );
64  }
65  // loop over entities
67  }

◆ initialize()

StatusCode Gaudi::Monitoring::BaseSink::initialize ( )
inlineoverride

Definition at line 32 of file BaseSink.h.

32  {
33  // registers itself to the Monitoring Hub
34  return Service::initialize().andThen( [&] { serviceLocator()->monitoringHub().addSink( this ); } );
35  }

◆ registerEntity()

void Gaudi::Monitoring::BaseSink::registerEntity ( Hub::Entity  ent)
inlineoverridevirtual

handles registration of a new entity

Implements Gaudi::Monitoring::Hub::Sink.

Definition at line 38 of file BaseSink.h.

38  {
39  if ( wanted( ent.type, m_typesToSave ) && wanted( ent.name, m_namesToSave ) &&
40  wanted( ent.component, m_componentsToSave ) ) {
42  }
43  }

◆ removeEntity()

void Gaudi::Monitoring::BaseSink::removeEntity ( Hub::Entity const &  ent)
inlineoverridevirtual

handles removal of an entity

Implements Gaudi::Monitoring::Hub::Sink.

Definition at line 46 of file BaseSink.h.

46  {
48  if ( it != m_monitoringEntities.end() ) { m_monitoringEntities.erase( it ); }
49  }

◆ Service()

Service::Service

Standard Constructor

Definition at line 81 of file Service.cpp.

339  : m_name( std::move( name ) ), m_svcLocator( svcloc ) {
340  if ( m_name != "MessageSvc" ) { // the MessageSvc should not notify itself
343  }
344 
345  // Initialize the default value from ApplicationMgr AuditAlgorithms
346  Gaudi::Property<bool> audit( false );
347  auto appMgr = serviceLocator()->service<IProperty>( "ApplicationMgr" );
348  if ( appMgr && appMgr->hasProperty( "AuditServices" ) ) { audit.assign( appMgr->getProperty( "AuditServices" ) ); }
349  m_auditInit = audit;
350  m_auditorInitialize = audit;
351  m_auditorStart = audit;
352  m_auditorStop = audit;
353  m_auditorFinalize = audit;
354  m_auditorReinitialize = audit;
355  m_auditorRestart = audit;
356 }

◆ wanted()

bool Gaudi::Monitoring::BaseSink::wanted ( std::string  name,
std::vector< std::string searchNames 
)
inlineprivate

deciding whether a given name matches the list of regexps given empty list means everything matches

Definition at line 72 of file BaseSink.h.

72  {
73  if ( searchNames.empty() ) { return true; }
74  for ( const auto& searchName : searchNames ) {
75  const std::regex regex( searchName );
76  if ( std::regex_match( name, regex ) ) { return true; }
77  }
78  return false;
79  }

Member Data Documentation

◆ m_componentsToSave

Gaudi::Property<std::vector<std::string> > Gaudi::Monitoring::BaseSink::m_componentsToSave
private
Initial value:
{
this, "ComponentsToSave", {}, "List of regexps used to match component names of entities to save" }

Definition at line 85 of file BaseSink.h.

◆ m_monitoringEntities

std::deque<Gaudi::Monitoring::Hub::Entity> Gaudi::Monitoring::BaseSink::m_monitoringEntities
private

list of entities we are dealing with

Definition at line 82 of file BaseSink.h.

◆ m_namesToSave

Gaudi::Property<std::vector<std::string> > Gaudi::Monitoring::BaseSink::m_namesToSave
private
Initial value:
{
this, "NamesToSave", {}, "List of regexps used to match names of entities to save" }

Definition at line 83 of file BaseSink.h.

◆ m_typesToSave

Gaudi::Property<std::vector<std::string> > Gaudi::Monitoring::BaseSink::m_typesToSave
private
Initial value:
{
this, "TypesToSave", {}, "List of regexps used to match type names of entities to save" }

Definition at line 87 of file BaseSink.h.


The documentation for this class was generated from the following file:
Service::m_auditorStart
Gaudi::Property< bool > m_auditorStart
Definition: Service.h:232
Service::m_auditorStop
Gaudi::Property< bool > m_auditorStop
Definition: Service.h:233
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: PropertyBase.h:35
std::for_each
T for_each(T... args)
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:118
Gaudi::Monitoring::BaseSink::m_namesToSave
Gaudi::Property< std::vector< std::string > > m_namesToSave
Definition: BaseSink.h:83
Gaudi::Monitoring::BaseSink::m_componentsToSave
Gaudi::Property< std::vector< std::string > > m_componentsToSave
Definition: BaseSink.h:85
StatusCode::andThen
StatusCode andThen(F &&f, ARGS &&... args) const
Chain code blocks making the execution conditional a success result.
Definition: StatusCode.h:163
std::move
T move(T... args)
std::find
T find(T... args)
Service::m_auditorInitialize
Gaudi::Property< bool > m_auditorInitialize
Definition: Service.h:231
Service::m_svcLocator
SmartIF< ISvcLocator > m_svcLocator
Service Locator reference
Definition: Service.h:215
Service::m_auditorReinitialize
Gaudi::Property< bool > m_auditorReinitialize
Definition: Service.h:235
std::regex_match
T regex_match(T... args)
Gaudi::Monitoring::BaseSink::m_monitoringEntities
std::deque< Gaudi::Monitoring::Hub::Entity > m_monitoringEntities
list of entities we are dealing with
Definition: BaseSink.h:82
std::sort
T sort(T... args)
Service::m_name
std::string m_name
Service Name
Definition: Service.h:213
std::tie
T tie(T... args)
Service::m_auditInit
Gaudi::Property< bool > m_auditInit
Definition: Service.h:230
IProperty
Definition: IProperty.h:33
Gaudi::Monitoring::BaseSink::m_typesToSave
Gaudi::Property< std::vector< std::string > > m_typesToSave
Definition: BaseSink.h:87
Service::name
const std::string & name() const override
Retrieve name of the service
Definition: Service.cpp:332
Service::m_auditorFinalize
Gaudi::Property< bool > m_auditorFinalize
Definition: Service.h:234
GaudiPluginService.cpluginsvc.func
func
Definition: cpluginsvc.py:236
CLHEP::begin
double * begin(CLHEP::HepVector &v)
Definition: TupleAlg.cpp:45
Service::m_auditorRestart
Gaudi::Property< bool > m_auditorRestart
Definition: Service.h:236
Gaudi::Property::declareUpdateHandler
Details::PropertyBase & declareUpdateHandler(std::function< void(Details::PropertyBase &)> fun) override
set new callback for update
Definition: Property.h:146
std::deque::erase
T erase(T... args)
CommonMessaging< implements< IService, IProperty, IStateful > >::updateMsgStreamOutputLevel
void updateMsgStreamOutputLevel(int level)
Update the output level of the cached MsgStream.
Definition: CommonMessaging.h:185
Gaudi::Monitoring::BaseSink::wanted
bool wanted(std::string name, std::vector< std::string > searchNames)
deciding whether a given name matches the list of regexps given empty list means everything matches
Definition: BaseSink.h:72
std::regex
IOTest.end
def end
Definition: IOTest.py:128
std::deque::emplace_back
T emplace_back(T... args)
std::vector::empty
T empty(T... args)
std::deque::end
T end(T... args)
IOTest.appMgr
appMgr
Definition: IOTest.py:108
Service::m_outputLevel
Gaudi::Property< int > m_outputLevel
flag indicating whether ToolHandle tools have been added to m_tools
Definition: Service.h:229
Gaudi::Property< bool >
Service::serviceLocator
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator
Definition: Service.cpp:335