Go to the documentation of this file.
71 virtual void flush(
bool isStop ) = 0;
79 m_flushThread = std::thread{ [this, flushStop = m_flushThreadStop.get_future()]() {
80 using namespace std::chrono_literals;
81 while ( flushStop.wait_for( m_autoFlushPeriod.value() * 1s ) == std::future_status::timeout ) {
90 m_flushThreadStop.set_value();
91 if ( m_flushThread.joinable() ) m_flushThread.join();
100 template <
typename Callable>
110 template <
typename Callable>
112 std::vector<Hub::Entity const*> sortedEntities;
113 applyToAllEntities( [&sortedEntities](
auto& ent ) { sortedEntities.emplace_back( &ent ); } );
114 std::sort( sortedEntities.begin(), sortedEntities.end(), [](
const auto* lhs,
const auto* rhs ) {
115 return std::tie( lhs->component, lhs->name ) < std::tie( rhs->component, rhs->name );
117 for (
auto const* ent : sortedEntities ) {
func( ent->component, ent->name, *ent ); }
122 bool wanted( std::string
const&
name, std::vector<std::string>
const& searchNames ) {
123 return searchNames.empty() || std::any_of( searchNames.begin(), searchNames.end(), [&](
const auto& searchName ) {
124 const std::regex regex( searchName );
125 return std::regex_match( name, regex );
132 return lhs.
id() < rhs.
id();
137 this,
"NamesToSave", {},
"List of regexps used to match names of entities to save" };
139 this,
"ComponentsToSave", {},
"List of regexps used to match component names of entities to save" };
141 this,
"TypesToSave", {},
"List of regexps used to match type names of entities to save" };
147 this,
"AutoFlushPeriod", 0.,
148 "if different from 0, indicates every how many seconds to force a write of the FSR data to OutputFile (this "
149 "parameter makes sense only if used in conjunction with OutputFile)" };
std::set< Gaudi::Monitoring::Hub::Entity, EntityOrder > m_monitoringEntities
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
list of entities we are dealing with
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
bool operator()(const Gaudi::Monitoring::Hub::Entity &lhs, const Gaudi::Monitoring::Hub::Entity &rhs) const
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
AttribStringParser::Iterator begin(const AttribStringParser &parser)
void for_each(ContainerOfSynced &c, Fun &&f)
const ValueType & value() const
void applyToAllSortedEntities(Callable func) const
applies a callable to all monitoring entities ordered by component the callable will be called once p...
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
bool wanted(std::string const &name, std::vector< std::string > const &searchNames)
deciding whether a given name matches the list of regexps given empty list means everything matches
Wrapper class for arbitrary monitoring objects.
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