Go to the documentation of this file.
70 virtual void flush(
bool isStop ) = 0;
78 m_flushThread = std::thread{ [this, flushStop = m_flushThreadStop.get_future()]() {
79 using namespace std::chrono_literals;
80 while ( flushStop.wait_for( m_autoFlushPeriod.value() * 1s ) == std::future_status::timeout ) {
89 m_flushThreadStop.set_value();
90 if ( m_flushThread.joinable() ) m_flushThread.join();
99 template <
typename Callable>
102 [
func](
auto& p ) {
func( p.second ); } );
110 applyToAllEntities( [&sortedEntities](
auto& ent ) { sortedEntities[ent.component][ent.name] = ent; } );
111 return sortedEntities;
117 if ( searchNames.
empty() ) {
return true; }
118 for (
const auto& searchName : searchNames ) {
128 this,
"NamesToSave", {},
"List of regexps used to match names of entities to save" };
130 this,
"ComponentsToSave", {},
"List of regexps used to match component names of entities to save" };
132 this,
"TypesToSave", {},
"List of regexps used to match type names of entities to save" };
138 this,
"AutoFlushPeriod", 0.,
139 "if different from 0, indicates every how many seconds to force a write of the FSR data to OutputFile (this "
140 "parameter makes sense only if used in conjunction with OutputFile)" };
Interface reporting services must implement.
Base class for all Sinks registering to the Monitoring Hub Should be extended by actual Sinks.
std::thread m_flushThread
Handling of regular flushes, if requested.
std::string name
name of the entity
StatusCode initialize() override
Gaudi::Property< std::vector< std::string > > m_namesToSave
void removeEntity(Hub::Entity const &ent) override
handles removal of an entity
Gaudi::Property< std::vector< std::string > > m_componentsToSave
StatusCode andThen(F &&f, ARGS &&... args) const
Chain code blocks making the execution conditional a success result.
StatusCode start() override
Gaudi::Property< float > m_autoFlushPeriod
void registerEntity(Hub::Entity ent) override
handles registration of a new entity
StatusCode initialize() override
StatusCode stop() override
StatusCode start() override
Gaudi::Property< std::vector< std::string > > m_typesToSave
double * begin(CLHEP::HepVector &v)
const ValueType & value() const
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
void * id() const
unique identifier, actually mapped to internal pointer
StatusCode stop() override
virtual void flush(bool isStop)=0
pure virtual method to be defined by children and responsible for flushing current data of the Sink.
Service(std::string name, ISvcLocator *svcloc)
Standard Constructor
void applyToAllEntities(Callable func) const
applies a callable to all monitoring entities
std::map< void *, Gaudi::Monitoring::Hub::Entity > m_monitoringEntities
list of entities we are dealing with
Wrapper class for arbitrary monitoring objects.
std::map< std::string, std::map< std::string, nlohmann::json > > sortedEntitiesAsJSON() const
returns all entities in JSON format, grouped by component first and then name
Implementation of property with value of concrete type.
SmartIF< ISvcLocator > & serviceLocator() const override
Retrieve pointer to service locator
std::string type
type of the entity, see comment above concerning its format and usage
std::string component
name of the component owning the Entity
std::promise< void > m_flushThreadStop