The Gaudi Framework  v36r9p1 (5c15b2bb)
Tuples::Local::Counter Class Referencefinal
Collaboration diagram for Tuples::Local::Counter:

Public Member Functions

 Counter (std::string msg=" Misbalance ")
 
 ~Counter ()
 
long increment (std::string_view object)
 
long decrement (std::string_view object)
 
long counts (std::string_view object) const
 
void report () const
 

Private Member Functions

long & get (std::string_view sv)
 
long get (std::string_view sv) const
 

Private Attributes

std::map< std::string, long, std::less<> > m_map
 
std::string m_message
 

Detailed Description

Definition at line 182 of file TupleObj.cpp.

Constructor & Destructor Documentation

◆ Counter()

Tuples::Local::Counter::Counter ( std::string  msg = " Misbalance ")
inline

Definition at line 185 of file TupleObj.cpp.

185 : m_message( std::move( msg ) ) {}

◆ ~Counter()

Tuples::Local::Counter::~Counter ( )
inline

Definition at line 187 of file TupleObj.cpp.

187 { report(); }

Member Function Documentation

◆ counts()

long Tuples::Local::Counter::counts ( std::string_view  object) const
inline

Definition at line 193 of file TupleObj.cpp.

193 { return get( object ); }

◆ decrement()

long Tuples::Local::Counter::decrement ( std::string_view  object)
inline

Definition at line 191 of file TupleObj.cpp.

191 { return --get( object ); }

◆ get() [1/2]

long& Tuples::Local::Counter::get ( std::string_view  sv)
inlineprivate

Definition at line 204 of file TupleObj.cpp.

204  {
205  auto i = m_map.find( sv );
206  if ( i == m_map.end() ) { i = m_map.emplace( std::pair{ std::string{ sv }, 0 } ).first; }
207  return i->second;
208  }

◆ get() [2/2]

long Tuples::Local::Counter::get ( std::string_view  sv) const
inlineprivate

Definition at line 209 of file TupleObj.cpp.

209  {
210  auto i = m_map.find( sv );
211  if ( i == m_map.end() ) throw;
212  return i->second;
213  }

◆ increment()

long Tuples::Local::Counter::increment ( std::string_view  object)
inline

Definition at line 189 of file TupleObj.cpp.

189 { return ++get( object ); }

◆ report()

void Tuples::Local::Counter::report ( ) const
inline

Definition at line 195 of file TupleObj.cpp.

195  {
196  for ( auto& entry : m_map ) {
197  if ( entry.second != 0 )
198  std::cout << "Tuples::TupleObj WARNING " << m_message << "'" << entry.first << "' Counts = " << entry.second
199  << std::endl;
200  }
201  };

Member Data Documentation

◆ m_map

std::map<std::string, long, std::less<> > Tuples::Local::Counter::m_map
private

Definition at line 214 of file TupleObj.cpp.

◆ m_message

std::string Tuples::Local::Counter::m_message
private

Definition at line 215 of file TupleObj.cpp.


The documentation for this class was generated from the following file:
Tuples::Local::Counter::get
long & get(std::string_view sv)
Definition: TupleObj.cpp:204
std::string
STL class.
std::move
T move(T... args)
std::pair
std::map::find
T find(T... args)
Tuples::Local::Counter::report
void report() const
Definition: TupleObj.cpp:195
GaudiMP.FdsRegistry.msg
msg
Definition: FdsRegistry.py:19
std::map::emplace
T emplace(T... args)
std::cout
std::endl
T endl(T... args)
std::map::end
T end(T... args)
Tuples::Local::Counter::m_map
std::map< std::string, long, std::less<> > m_map
Definition: TupleObj.cpp:214
Tuples::Local::Counter::m_message
std::string m_message
Definition: TupleObj.cpp:215