The Gaudi Framework  v36r1 (3e2fb5a8)
GaudiToolLocal::Counter Class Referencefinal
Collaboration diagram for GaudiToolLocal::Counter:

Public Member Functions

 Counter (std::string msg=" Misbalance ")
 
 ~Counter ()
 
long increment (std::string_view object)
 make the increment More...
 
long decrement (std::string_view object)
 make the decrement More...
 
long counts (std::string_view object)
 current count More...
 
void report () const
 make a report More...
 

Private Types

using Map = std::map< std::string, long, std::less<> >
 

Private Member Functions

long & get (std::string_view which)
 

Private Attributes

Map m_map
 
std::string m_message
 

Detailed Description

simple local counter

Definition at line 68 of file GaudiTool.cpp.

Member Typedef Documentation

◆ Map

Definition at line 99 of file GaudiTool.cpp.

Constructor & Destructor Documentation

◆ Counter()

GaudiToolLocal::Counter::Counter ( std::string  msg = " Misbalance ")
inline

Definition at line 72 of file GaudiTool.cpp.

72 : m_message( std::move( msg ) ){};

◆ ~Counter()

GaudiToolLocal::Counter::~Counter ( )
inline

Definition at line 74 of file GaudiTool.cpp.

74 { report(); }

Member Function Documentation

◆ counts()

long GaudiToolLocal::Counter::counts ( std::string_view  object)
inline

current count

Definition at line 83 of file GaudiTool.cpp.

83 { return get( object ); }

◆ decrement()

long GaudiToolLocal::Counter::decrement ( std::string_view  object)
inline

make the decrement

Definition at line 81 of file GaudiTool.cpp.

81 { return --get( object ); }

◆ get()

long& GaudiToolLocal::Counter::get ( std::string_view  which)
inlineprivate

Definition at line 100 of file GaudiTool.cpp.

100  {
101  auto i = m_map.find( which );
102  if ( i == m_map.end() ) i = m_map.emplace( which, long{} ).first;
103  return i->second;
104  }

◆ increment()

long GaudiToolLocal::Counter::increment ( std::string_view  object)
inline

make the increment

Definition at line 79 of file GaudiTool.cpp.

79 { return ++get( object ); }

◆ report()

void GaudiToolLocal::Counter::report ( ) const
inline

make a report

keep the silence?

Definition at line 85 of file GaudiTool.cpp.

85  {
87  if ( !GaudiTool::summaryEnabled() ) { return; } // RETURN
88  //
89  for ( const auto& entry : m_map ) {
90  if ( entry.second ) {
91  std::cout << "GaudiTool WARNING " << m_message << "'" << entry.first << "' Counts = " << entry.second
92  << std::endl;
93  }
94  }
95  }

Member Data Documentation

◆ m_map

Map GaudiToolLocal::Counter::m_map
private

Definition at line 105 of file GaudiTool.cpp.

◆ m_message

std::string GaudiToolLocal::Counter::m_message
private

Definition at line 106 of file GaudiTool.cpp.


The documentation for this class was generated from the following file:
std::move
T move(T... args)
std::map::find
T find(T... args)
GaudiTool::summaryEnabled
static bool summaryEnabled()
is summary enabled?
Definition: GaudiTool.cpp:140
GaudiMP.FdsRegistry.msg
msg
Definition: FdsRegistry.py:18
std::map::emplace
T emplace(T... args)
GaudiToolLocal::Counter::m_message
std::string m_message
Definition: GaudiTool.cpp:106
std::cout
GaudiTesting.BaseTest.which
def which(executable)
Definition: BaseTest.py:674
GaudiToolLocal::Counter::m_map
Map m_map
Definition: GaudiTool.cpp:105
GaudiToolLocal::Counter::get
long & get(std::string_view which)
Definition: GaudiTool.cpp:100
std::endl
T endl(T... args)
std::map::end
T end(T... args)
GaudiToolLocal::Counter::report
void report() const
make a report
Definition: GaudiTool.cpp:85