The Gaudi Framework  v29r0 (ff2e7097)
CounterSvc Class Reference

Simple implementation of the abstract interface ICounterSvc. More...

Inheritance diagram for CounterSvc:
Collaboration diagram for CounterSvc:

Public Member Functions

 ~CounterSvc () override
 Standard destructor. More...
 
StatusCode finalize () override
 Finalization. More...
 
Counter * get (const std::string &group, const std::string &name) const override
 Access an existing counter object. More...
 
ICounterSvc::Counters get (const std::string &group) const override
 get all counters form the given group: More...
 
StatusCode create (const std::string &group, const std::string &name, longlong initial_value, Counter *&refpCounter) override
 Create a new counter object. More...
 
CountObject create (const std::string &group, const std::string &name, longlong initial_value=0) override
 Create a new counter object. More...
 
StatusCode remove (const std::string &group, const std::string &name) override
 Remove a counter object. More...
 
StatusCode remove (const std::string &group) override
 Remove all counters of a given group. More...
 
virtual StatusCode remove ()
 Remove all known counter objects. More...
 
StatusCode print (const std::string &group, const std::string &name, Printout &printer) const override
 Print counter value. More...
 
StatusCode print (const std::string &group, Printout &printer) const override
 If no such counter exists the return code is COUNTER_NOT_PRESENT Note: This call is not direct access. More...
 
StatusCode print (const Counter *pCounter, Printout &printer) const override
 Print counter value. More...
 
StatusCode print (const CountObject &pCounter, Printout &printer) const override
 Print counter value. More...
 
StatusCode print (Printout &printer) const override
 
StatusCode defaultPrintout (MsgStream &log, const Counter *pCounter) const override
 Default Printout for counters. More...
 
void print () const
 "standard" printout a'la GaudiCommon More...
 
- Public Member Functions inherited from extends< Service, ICounterSvc >
void * i_cast (const InterfaceID &tid) const override
 Implementation of IInterface::i_cast. More...
 
StatusCode queryInterface (const InterfaceID &ti, void **pp) override
 Implementation of IInterface::queryInterface. More...
 
std::vector< std::stringgetInterfaceNames () const override
 Implementation of IInterface::getInterfaceNames. More...
 
 ~extends () override=default
 Virtual destructor. More...
 
- Public Member Functions inherited from Service
const std::stringname () const override
 Retrieve name of the service. More...
 
StatusCode configure () override
 
StatusCode initialize () override
 
StatusCode start () override
 
StatusCode stop () override
 
StatusCode finalize () override
 
StatusCode terminate () override
 
Gaudi::StateMachine::State FSMState () const override
 
Gaudi::StateMachine::State targetFSMState () const override
 
StatusCode reinitialize () override
 
StatusCode restart () override
 
StatusCode sysInitialize () override
 Initialize Service. More...
 
StatusCode sysStart () override
 Initialize Service. More...
 
StatusCode sysStop () override
 Initialize Service. More...
 
StatusCode sysFinalize () override
 Finalize Service. More...
 
StatusCode sysReinitialize () override
 Re-initialize the Service. More...
 
StatusCode sysRestart () override
 Re-initialize the Service. More...
 
 Service (std::string name, ISvcLocator *svcloc)
 Standard Constructor. More...
 
SmartIF< ISvcLocator > & serviceLocator () const override
 Retrieve pointer to service locator. More...
 
StatusCode setProperties ()
 Method for setting declared properties to the values specified for the job. More...
 
template<class T >
StatusCode service (const std::string &name, const T *&psvc, bool createIf=true) const
 Access a service by name, creating it if it doesn't already exist. More...
 
template<class T >
StatusCode service (const std::string &name, T *&psvc, bool createIf=true) const
 
template<typename IFace = IService>
SmartIF< IFace > service (const std::string &name, bool createIf=true) const
 
template<class T >
StatusCode service (const std::string &svcType, const std::string &svcName, T *&psvc) const
 Access a service by name and type, creating it if it doesn't already exist. More...
 
template<class T >
StatusCode declareTool (ToolHandle< T > &handle, std::string toolTypeAndName, bool createIf=true)
 Declare used tool. More...
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
 
- Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
 PropertyHolder ()=default
 
 ~PropertyHolder () override=default
 
Gaudi::Details::PropertyBasedeclareProperty (Gaudi::Details::PropertyBase &prop)
 Declare a property. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
 Helper to wrap a regular data member and use it as a regular property. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, TYPE &value, const std::string &doc="none") const
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
 Declare a PropertyBase instance setting name and documentation. More...
 
Gaudi::Details::PropertyBasedeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
 Declare a remote property. More...
 
StatusCode setProperty (const Gaudi::Details::PropertyBase &p) override
 set the property form another property More...
 
StatusCode setProperty (const std::string &s) override
 set the property from the formatted string More...
 
StatusCode setProperty (const std::string &n, const std::string &v) override
 set the property from name and the value More...
 
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
StatusCode getProperty (Gaudi::Details::PropertyBase *p) const override
 get the property More...
 
const Gaudi::Details::PropertyBasegetProperty (const std::string &name) const override
 get the property by name More...
 
StatusCode getProperty (const std::string &n, std::string &v) const override
 convert the property to the string More...
 
const std::vector< Gaudi::Details::PropertyBase * > & getProperties () const override
 get all properties More...
 
bool hasProperty (const std::string &name) const override
 Return true if we have a property with the given name. More...
 
 PropertyHolder (const PropertyHolder &)=delete
 
PropertyHolderoperator= (const PropertyHolder &)=delete
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, GaudiHandleBase &ref, const std::string &doc="none")
 Specializations for various GaudiHandles. More...
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, GaudiHandleArrayBase &ref, const std::string &doc="none")
 
Gaudi::Details::PropertyBasedeclareProperty (const std::string &name, DataObjectHandleBase &ref, const std::string &doc="none")
 
- Public Member Functions inherited from CommonMessagingBase
virtual ~CommonMessagingBase ()=default
 Virtual destructor. More...
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MSG::Level msgLevel () const
 get the output level from the embedded MsgStream More...
 
MSG::Level outputLevel () const __attribute__((deprecated))
 Backward compatibility function for getting the output level. More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
- Public Member Functions inherited from extend_interfaces< Interfaces... >
 ~extend_interfaces () override=default
 Virtual destructor. More...
 

Private Types

typedef GaudiUtils::HashMap< std::string, Counter * > NameMap
 
typedef GaudiUtils::HashMap< std::string, NameMapCountMap
 

Private Member Functions

std::pair< std::string, std::string_find (const Counter *c) const
 
size_t num () const
 

Private Attributes

CountMap m_counts
 the actual map of counters More...
 
Gaudi::Property< bool > m_print {this, "PrintStat", true, "print statistics"}
 
Gaudi::Property< std::stringm_header
 
Gaudi::Property< std::stringm_format1
 
Gaudi::Property< std::stringm_format2
 
Gaudi::Property< bool > m_useEffFormat
 

Additional Inherited Members

- Public Types inherited from extends< Service, ICounterSvc >
using base_class = extends
 Typedef to this class. More...
 
using extend_interfaces_base = extend_interfaces< Interfaces... >
 Typedef to the base of this class. More...
 
- Public Types inherited from Service
typedef Gaudi::PluginService::Factory< IService *, const std::string &, ISvcLocator * > Factory
 
- Public Types inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
using PropertyHolderImpl = PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
 Typedef used to refer to this class from derived classes, as in. More...
 
- Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using base_class = CommonMessaging
 
- Public Types inherited from extend_interfaces< Interfaces... >
using ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type
 take union of the ext_iids of all Interfaces... More...
 
- Protected Member Functions inherited from Service
 ~Service () override
 Standard Destructor. More...
 
int outputLevel () const
 get the Service's output level More...
 
- Protected Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
Gaudi::Details::PropertyBaseproperty (const std::string &name) const
 
- Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 
- Protected Attributes inherited from Service
Gaudi::StateMachine::State m_state = Gaudi::StateMachine::OFFLINE
 Service state. More...
 
Gaudi::StateMachine::State m_targetState = Gaudi::StateMachine::OFFLINE
 Service state. More...
 
Gaudi::Property< int > m_outputLevel {this, "OutputLevel", MSG::NIL, "output level"}
 
Gaudi::Property< bool > m_auditInit {this, "AuditServices", false, "[[deprecated]] unused"}
 
Gaudi::Property< bool > m_auditorInitialize {this, "AuditInitialize", false, "trigger auditor on initialize()"}
 
Gaudi::Property< bool > m_auditorStart {this, "AuditStart", false, "trigger auditor on start()"}
 
Gaudi::Property< bool > m_auditorStop {this, "AuditStop", false, "trigger auditor on stop()"}
 
Gaudi::Property< bool > m_auditorFinalize {this, "AuditFinalize", false, "trigger auditor on finalize()"}
 
Gaudi::Property< bool > m_auditorReinitialize {this, "AuditReinitialize", false, "trigger auditor on reinitialize()"}
 
Gaudi::Property< bool > m_auditorRestart {this, "AuditRestart", false, "trigger auditor on restart()"}
 
SmartIF< IAuditorSvcm_pAuditorSvc
 Auditor Service. More...
 

Detailed Description

Simple implementation of the abstract interface ICounterSvc.

Author
Markus FRANK
Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.physi.nosp@m.cs.s.nosp@m.yr.ed.nosp@m.u
Date
2007-05-25

Definition at line 25 of file CounterSvc.cpp.

Member Typedef Documentation

Definition at line 162 of file CounterSvc.cpp.

Definition at line 161 of file CounterSvc.cpp.

Constructor & Destructor Documentation

CounterSvc::~CounterSvc ( )
inlineoverride

Standard destructor.

Definition at line 31 of file CounterSvc.cpp.

31 { remove().ignore(); }

Member Function Documentation

std::pair<std::string, std::string> CounterSvc::_find ( const Counter *  c) const
inlineprivate

Definition at line 136 of file CounterSvc.cpp.

137  {
138  if ( c ) {
139  for ( const auto& i : m_counts ) {
140  auto j = std::find_if( i.second.begin(), i.second.end(),
141  [&]( const NameMap::value_type& k ) { return k.second == c; } );
142  if ( j != i.second.end() ) return {i.first, j->first};
143  }
144  }
145  return {};
146  }
CountMap m_counts
the actual map of counters
Definition: CounterSvc.cpp:164
T find_if(T...args)
std::pair< const K, T > value_type
Definition: Map.h:94
StatusCode CounterSvc::create ( const std::string group,
const std::string name,
longlong  initial_value,
Counter *&  refpCounter 
)
override

Create a new counter object.

If the counter object exists already the existing object is returned. In this event the return code is COUNTER_EXISTS. The ownership of the actual counter stays with the service.

Parameters
group[IN] Hint for smart printing
name[IN] Counter name
initial_value[IN] Initial counter value
refpCounter[OUT] Reference to store pointer to counter.
Returns
StatusCode indicating failure or success.

Definition at line 224 of file CounterSvc.cpp.

226 {
227  // try to find existing counter:
228  refpCounter = get( grp, nam );
229  if ( refpCounter ) {
230  return COUNTER_EXISTS;
231  } // RETURN
232  // create the new counter
233  auto newc = new Counter();
234  refpCounter = newc;
235  if ( 0 != initial_value ) {
236  refpCounter->addFlag( static_cast<double>( initial_value ) ); // icc remark #2259
237  }
238  // find a proper group
239  auto i = m_counts.find( grp );
240  // (create a group if needed)
241  if ( m_counts.end() == i ) {
242  i = m_counts.emplace( grp, NameMap() ).first;
243  }
244  // insert new counter with proper name into proper group:
245  i->second.emplace( nam, newc );
246  return StatusCode::SUCCESS; // RETURN
247 }
GaudiUtils::HashMap< std::string, Counter * > NameMap
Definition: CounterSvc.cpp:161
iterator end()
Definition: Map.h:134
CountMap m_counts
the actual map of counters
Definition: CounterSvc.cpp:164
iterator find(const key_type &key)
Definition: Map.h:151
std::pair< iterator, bool > emplace(Args &&...args)
Definition: Map.h:169
CounterSvc::CountObject CounterSvc::create ( const std::string group,
const std::string name,
longlong  initial_value = 0 
)
override

Create a new counter object.

If the counter object exists already, a std::runtime_error exception is thrown. The ownership of the actual counter stays with the service.

Parameters
group[IN] Hint for smart printing
name[IN] Counter name
initial_value[IN] Initial counter value
refpCounter[OUT] Reference to store pointer to counter.
Returns
Fully initialized CountObject.

Definition at line 255 of file CounterSvc.cpp.

256 {
257  Counter* p = nullptr;
258  StatusCode sc = create( group, name, initial_value, p );
259  if ( sc.isSuccess() && p ) {
260  return CountObject( p, group, name );
261  }
262  throw std::runtime_error( "CounterSvc::Counter('" + group + "::" + name + "') exists already!" );
263 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
StatusCode create(const std::string &group, const std::string &name, longlong initial_value, Counter *&refpCounter) override
Create a new counter object.
Definition: CounterSvc.cpp:224
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
StatusCode CounterSvc::defaultPrintout ( MsgStream log,
const Counter *  pCounter 
) const
override

Default Printout for counters.

Definition at line 381 of file CounterSvc.cpp.

382 {
383  if ( !c ) {
384  return StatusCode::FAILURE;
385  }
386  auto p = _find( c );
387 
388  log << MSG::ALWAYS << CountObject( const_cast<Counter*>( c ), p.first, p.second ) << endmsg;
389 
390  return StatusCode::SUCCESS;
391 }
std::pair< std::string, std::string > _find(const Counter *c) const
Definition: CounterSvc.cpp:136
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
StatusCode CounterSvc::finalize ( )
inlineoverride

Finalization.

< finalize the base class

Definition at line 33 of file CounterSvc.cpp.

34  {
35  if ( msgLevel( MSG::DEBUG ) || m_print ) {
36  print();
37  }
38  remove().ignore();
39  // finalize the base class
40  return Service::finalize();
41  }
Gaudi::Property< bool > m_print
Definition: CounterSvc.cpp:166
StatusCode finalize() override
Definition: Service.cpp:174
void print() const
"standard" printout a&#39;la GaudiCommon
Definition: CounterSvc.cpp:395
MSG::Level msgLevel() const
get the output level from the embedded MsgStream
CounterSvc::Counter * CounterSvc::get ( const std::string group,
const std::string name 
) const
override

Access an existing counter object.

Parameters
group[IN] Hint for smart printing
name[IN] Counter name
Returns
Pointer to existing counter object (NULL if non existing).

Definition at line 189 of file CounterSvc.cpp.

190 {
191  auto i = m_counts.find( grp );
192  if ( m_counts.end() == i ) {
193  return nullptr;
194  } // RETURN
195  auto j = i->second.find( nam );
196  if ( i->second.end() == j ) {
197  return nullptr;
198  } // RETURN
199  return j->second; // RETURN
200 }
iterator end()
Definition: Map.h:134
CountMap m_counts
the actual map of counters
Definition: CounterSvc.cpp:164
iterator find(const key_type &key)
Definition: Map.h:151
ICounterSvc::Counters CounterSvc::get ( const std::string group) const
override

get all counters form the given group:

Definition at line 204 of file CounterSvc.cpp.

205 {
206  ICounterSvc::Counters result;
207  auto i = m_counts.find( group );
208  if ( i != m_counts.end() ) {
209  std::transform( i->second.begin(), i->second.end(), std::back_inserter( result ),
210  [&]( const NameMap::value_type& j ) {
211  return CountObject{j.second, i->first, j.first};
212  } );
213  }
214  return result;
215 }
iterator end()
Definition: Map.h:134
CountMap m_counts
the actual map of counters
Definition: CounterSvc.cpp:164
iterator find(const key_type &key)
Definition: Map.h:151
STL class.
T back_inserter(T...args)
std::pair< const K, T > value_type
Definition: Map.h:94
T transform(T...args)
size_t CounterSvc::num ( ) const
inlineprivate

Definition at line 148 of file CounterSvc.cpp.

149  {
150  return std::accumulate( m_counts.begin(), m_counts.end(), size_t{0}, []( size_t r, const CountMap::value_type& i ) {
151  return r + std::count_if( i.second.begin(), i.second.end(),
152  []( const NameMap::value_type& j ) -> bool { return j.second; } );
153  } );
154  }
iterator end()
Definition: Map.h:134
CountMap m_counts
the actual map of counters
Definition: CounterSvc.cpp:164
T count_if(T...args)
iterator begin()
Definition: Map.h:133
T accumulate(T...args)
StatusCode CounterSvc::print ( const std::string group,
const std::string name,
Printout &  printer 
) const
override

Print counter value.

Parameters
group[IN] Hint for smart printing
name[IN] Counter name
printer[IN] Print actor
Returns
StatusCode indicating failure or success.

Definition at line 307 of file CounterSvc.cpp.

308 {
309  const Counter* c = get( grp, nam );
310  if ( !c ) {
311  return COUNTER_NOT_PRESENT;
312  } // RETURN
313  // create the stream and use it!
314  return printer( msgStream(), c );
315 }
MsgStream & msgStream() const
Return an uninitialized MsgStream.
StatusCode CounterSvc::print ( const std::string group,
Printout &  printer 
) const
override

If no such counter exists the return code is COUNTER_NOT_PRESENT Note: This call is not direct access.

Parameters
group[IN] Hint for smart printing
printer[IN] Print actor
Returns
StatusCode indicating failure or success.

Definition at line 340 of file CounterSvc.cpp.

341 {
342  auto i = m_counts.find( grp );
343  if ( m_counts.end() == i ) {
344  return COUNTER_NOT_PRESENT;
345  }
346 
347  // Force printing in alphabetical order
348  std::map<std::string, Counter*> sorted_map( i->second.begin(), i->second.end() );
349  std::for_each( sorted_map.begin(), sorted_map.end(), conditionalPrint( printer, msgStream() ) );
350  return StatusCode::SUCCESS; // RETURN
351 }
STL class.
iterator end()
Definition: Map.h:134
CountMap m_counts
the actual map of counters
Definition: CounterSvc.cpp:164
iterator find(const key_type &key)
Definition: Map.h:151
MsgStream & msgStream() const
Return an uninitialized MsgStream.
T for_each(T...args)
StatusCode CounterSvc::print ( const Counter *  pCounter,
Printout &  printer 
) const
override

Print counter value.

Parameters
pCounter[IN] Pointer to Counter object
printer[IN] Print actor
Returns
StatusCode indicating failure or success.

Definition at line 355 of file CounterSvc.cpp.

356 {
357  return printer( msgStream(), pCounter );
358 }
MsgStream & msgStream() const
Return an uninitialized MsgStream.
StatusCode CounterSvc::print ( const CountObject &  pCounter,
Printout &  printer 
) const
override

Print counter value.

Parameters
refCounter[IN] Reference to CountObject object
printer[IN] Print actor
Returns
StatusCode indicating failure or success.

Definition at line 362 of file CounterSvc.cpp.

363 {
364  return print( refCounter.counter(), printer );
365 }
void print() const
"standard" printout a&#39;la GaudiCommon
Definition: CounterSvc.cpp:395
StatusCode CounterSvc::print ( Printout &  printer) const
override
Parameters
printer[IN] Print actor
Returns
StatusCode indicating failure or success.

Definition at line 369 of file CounterSvc.cpp.

370 {
371  // Force printing in alphabetical order
373  for ( const auto& i : m_counts )
374  for ( const auto& j : i.second ) sorted_map[{i.first, j.first}] = j.second;
375  std::for_each( sorted_map.begin(), sorted_map.end(), conditionalPrint( printer, msgStream() ) );
376  return StatusCode::SUCCESS;
377 }
T end(T...args)
STL class.
CountMap m_counts
the actual map of counters
Definition: CounterSvc.cpp:164
T begin(T...args)
MsgStream & msgStream() const
Return an uninitialized MsgStream.
T for_each(T...args)
void CounterSvc::print ( ) const

"standard" printout a'la GaudiCommon

Definition at line 395 of file CounterSvc.cpp.

396 {
397  // number of counters
398  const auto _num = num();
399  if ( 0 != _num ) {
400  always() << "Number of counters : " << _num << endmsg << m_header.value() << endmsg;
401  }
402  // Force printing in alphabetical order
404  for ( const auto& i : m_counts ) {
405  for ( const auto& j : i.second ) {
406  if ( j.second ) sorted_map[{i.first, j.first}] = j.second;
407  }
408  }
409  for ( const auto& i : sorted_map ) {
410  always() << Gaudi::Utils::formatAsTableRow( i.first.second, i.first.first, *i.second, m_useEffFormat, m_format1,
411  m_format2 )
412  << endmsg;
413  }
414 }
Gaudi::Property< bool > m_useEffFormat
Definition: CounterSvc.cpp:179
Gaudi::Property< std::string > m_format1
Definition: CounterSvc.cpp:171
Gaudi::Property< std::string > m_header
Definition: CounterSvc.cpp:167
STL class.
Gaudi::Property< std::string > m_format2
Definition: CounterSvc.cpp:175
GAUDI_API std::string formatAsTableRow(const StatEntity &counter, const bool flag, const std::string &format1=" |%|7d| |%|11.7g| |%|#11.5g| |%|#10.5g| |%|#10.5g| |%|#10.5g| |", const std::string &format2="*|%|7d| |%|11.5g| |(%|#9.7g| +- %|-#8.6g|)%%| ----- | ----- |")
print the counter in a form of the table row
Definition: StatEntity.cpp:305
CountMap m_counts
the actual map of counters
Definition: CounterSvc.cpp:164
MsgStream & always() const
shortcut for the method msgStream(MSG::ALWAYS)
size_t num() const
Definition: CounterSvc.cpp:148
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
StatusCode CounterSvc::remove ( const std::string group,
const std::string name 
)
override

Remove a counter object.

If the counter object does not exists, the return code is COUNTER_NOT_PRESENT. The counter may not be used anymore after this call.

Parameters
group[IN] Hint for smart printing
name[IN] Counter name
initial_value[IN] Initial counter value
refpCounter[OUT] Reference to store pointer to counter.
Returns
StatusCode indicating failure or success.

Definition at line 267 of file CounterSvc.cpp.

268 {
269  auto i = m_counts.find( grp );
270  if ( m_counts.end() == i ) {
271  return COUNTER_NOT_PRESENT;
272  } // RETURN
273  auto j = i->second.find( nam );
274  if ( i->second.end() == j ) {
275  return COUNTER_NOT_PRESENT;
276  } // RETURN
277  delete j->second;
278  i->second.erase( j );
279  return StatusCode::SUCCESS;
280 }
iterator end()
Definition: Map.h:134
CountMap m_counts
the actual map of counters
Definition: CounterSvc.cpp:164
iterator find(const key_type &key)
Definition: Map.h:151
StatusCode CounterSvc::remove ( const std::string group)
override

Remove all counters of a given group.

If no such counter exists the return code is COUNTER_NOT_PRESENT

Parameters
group[IN] Hint for smart printing
Returns
StatusCode indicating failure or success.

Definition at line 284 of file CounterSvc.cpp.

285 {
286  auto i = m_counts.find( grp );
287  if ( m_counts.end() == i ) {
288  return COUNTER_NOT_PRESENT;
289  } // RETURN
290  for ( auto& j : i->second ) delete j.second;
291  i->second.clear();
292  return StatusCode::SUCCESS;
293 }
iterator end()
Definition: Map.h:134
CountMap m_counts
the actual map of counters
Definition: CounterSvc.cpp:164
iterator find(const key_type &key)
Definition: Map.h:151
StatusCode CounterSvc::remove ( )
virtual

Remove all known counter objects.

Definition at line 297 of file CounterSvc.cpp.

298 {
299  // remove group by group
300  for ( auto& i : m_counts ) remove( i.first ).ignore();
301  m_counts.clear();
302  return StatusCode::SUCCESS;
303 }
CountMap m_counts
the actual map of counters
Definition: CounterSvc.cpp:164

Member Data Documentation

CountMap CounterSvc::m_counts
private

the actual map of counters

Definition at line 164 of file CounterSvc.cpp.

Gaudi::Property<std::string> CounterSvc::m_format1
private
Initial value:
{
this, "RegularRowFormat",
" %|15.15s|%|-15.15s|%|32t||%|10d| |%|11.7g| |%|#11.5g| |%|#11.5g| |%|#12.5g| |%|#12.5g| |",
"the format for the regular row in the output Stat-table"}

Definition at line 171 of file CounterSvc.cpp.

Gaudi::Property<std::string> CounterSvc::m_format2
private
Initial value:
{
this, "EfficiencyRowFormat",
"*%|15.15s|%|-15.15s|%|32t||%|10d| |%|11.5g| |(%|#9.7g| +- %|-#9.7g|)%%| ------- | ------- |",
"the format for the regular row in the outptu Stat-table"}

Definition at line 175 of file CounterSvc.cpp.

Gaudi::Property<std::string> CounterSvc::m_header
private
Initial value:
{this, "StatTableHeader",
" Counter :: Group | # | sum | "
"mean/eff^* | rms/err^* | min | max |",
"the header row for the output Stat-table"}

Definition at line 167 of file CounterSvc.cpp.

Gaudi::Property<bool> CounterSvc::m_print {this, "PrintStat", true, "print statistics"}
private

Definition at line 166 of file CounterSvc.cpp.

Gaudi::Property<bool> CounterSvc::m_useEffFormat
private
Initial value:
{this, "UseEfficiencyRowFormat", true,
"use the special format for printout of efficiency counters"}

Definition at line 179 of file CounterSvc.cpp.


The documentation for this class was generated from the following file: