1 #ifndef GAUDIKERNEL_COUNTERHOLDER_H 2 #define GAUDIKERNEL_COUNTERHOLDER_H 17 static_assert( std::is_base_of_v<INamedInterface, BASE>,
18 "CounterHolder template argument must inherit from INamedInterface" );
25 m_counters.emplace( tag, r );
30 auto p = m_counters.find( tag );
31 return p != m_counters.end() ? &p->second.get() :
nullptr;
34 template <
typename Callable>
38 [f = std::forward<Callable>( f )](
const auto& p ) { std::invoke( f, p.first, p.second.get() ); } );
43 return m_counters.size();
48 return count_if(
begin( m_counters ),
end( m_counters ),
49 [](
const auto&
c ) {
return c.second.get().toBePrinted(); } );
const Gaudi::Accumulators::PrintableCounter * findCounter(const std::string &tag) const
An empty ancester of all counters that knows how to print themselves.
void declareCounter(const std::string &tag, Gaudi::Accumulators::PrintableCounter &r)
std::size_t nOfCountersToBePrinted()
void forEachCounter(Callable &&f) const
IInterface compliant class extending IInterface with the name() method.
AttribStringParser::Iterator begin(const AttribStringParser &parser)
std::map< std::string, std::reference_wrapper< Gaudi::Accumulators::PrintableCounter > > m_counters