|
Gaudi Framework, version v21r9 |
| Home | Generated: 3 May 2010 |
#include <GaudiKernel/ICounterSvc.h>


Public Types | |
| enum | { COUNTER_NOT_PRESENT = 2, COUNTER_EXISTS = 4, COUNTER_REMOVED = 3 } |
| typedef StatEntity | Counter |
| the actual type of counter | |
| typedef Stat | CountObject |
| Ease the manipulation of counters in a way, that they behave like objects: Avoid: Counter* cnt = . | |
| typedef std::vector< CountObject > | Counters |
| the actual type of vectors of initialized counters | |
Public Member Functions | |
| DeclareInterfaceID (ICounterSvc, 4, 0) | |
| InterfaceID. | |
| virtual Counter * | get (const std::string &group, const std::string &name) const =0 |
| Access an existing counter object. | |
| virtual Counters | get (const std::string &group) const =0 |
| get all counters form the given group: | |
| virtual StatusCode | create (const std::string &group, const std::string &name, longlong initial_value, Counter *&refpCounter)=0 |
| Create a new counter object. | |
| virtual CountObject | create (const std::string &group, const std::string &name, longlong initial_value=0)=0 |
| If the counter object exists already, a std::runtime_error exception is thrown. | |
| virtual StatusCode | remove (const std::string &group, const std::string &name)=0 |
| Remove a counter object. | |
| virtual StatusCode | remove (const std::string &group)=0 |
| Remove all counters of a given group. | |
| virtual StatusCode | print (const std::string &group, const std::string &name, Printout &printer) const =0 |
| Print counter value. | |
| virtual StatusCode | print (const std::string &group, Printout &printer) const =0 |
| If no such counter exists the return code is COUNTER_NOT_PRESENT Note: This call is not direct access. | |
| virtual StatusCode | print (const Counter *pCounter, Printout &printer) const =0 |
| Print counter value. | |
| virtual StatusCode | print (const CountObject &pCounter, Printout &printer) const =0 |
| Print counter value. | |
| virtual StatusCode | print (Printout &printer) const =0 |
| virtual StatusCode | defaultPrintout (MsgStream &log, const Counter *pCounter) const =0 |
| Default Printout for counters. | |
Protected Member Functions | |
| virtual | ~ICounterSvc () |
| protected virtual destructor | |
Classes | |
| class | Printout |
| Print counters for each element in the range [first, last) e.g. More... | |
Counter Creation: -----------------
// counter creation: ICounterSvc::CountObject obj = svc->create("AlgName","NumExecuted",0); obj++; obj += 10; ICounterSvc::Counter* m_counter = obj.counter(); // ICounterSvc::Counter* m_counter = obj ; ///< the same ICounterSvc::Counter* m_counter = 0; if ( svc->create("AlgName","NumExecuted",0, m_counter).isSuccess() ) { CountObject obj(m_counter); obj++; }
Counter access: ---------------
ICounterSvc::Counter* m_counter = svc->get("AlgName","NumExecuted"); if ( m_counter ) {....} // or: try { ICounterSvc::CountObject obj(svc->get("AlgName","NumExecuted")); obj++; } catch(std::invalid_argument e) { ...handle exception ... }
Definition at line 78 of file ICounterSvc.h.
| typedef StatEntity ICounterSvc::Counter |
| typedef Stat ICounterSvc::CountObject |
Ease the manipulation of counters in a way, that they behave like objects: Avoid: Counter* cnt = .
..; ++(*cnt);
Instead: Counter* cnt = ...; CountObject obj(cnt); ++cnt;
Note: No inheritance! This class has no virtual destructor
Definition at line 100 of file ICounterSvc.h.
| typedef std::vector<CountObject> ICounterSvc::Counters |
| anonymous enum |
Definition at line 256 of file ICounterSvc.h.
00256 { COUNTER_NOT_PRESENT = 2, // Error 00257 COUNTER_EXISTS = 4, // Error ? 00258 COUNTER_REMOVED = 3 // Type of success. Low bit set 00259 } ;
| ICounterSvc::~ICounterSvc | ( | ) | [protected, virtual] |
protected virtual destructor
protected virtual destructor
Definition at line 30 of file ICounterSvc.cpp.
| ICounterSvc::DeclareInterfaceID | ( | ICounterSvc | , | |
| 4 | , | |||
| 0 | ||||
| ) |
| virtual Counter* ICounterSvc::get | ( | const std::string & | group, | |
| const std::string & | name | |||
| ) | const [pure virtual] |
Access an existing counter object.
| group | [IN] Hint for smart printing | |
| name | [IN] Counter name | |
| createIf | [IN] flag to indicate the creation if not counter found |
Implemented in CounterSvc.
| virtual Counters ICounterSvc::get | ( | const std::string & | group | ) | const [pure virtual] |
get all counters form the given group:
ICounterSvc::Counters cnts = svc->get("Efficiency") ; MsgStream& stream = ... ; for ( ICounterSvc::Counters::const_iterator ic = cnts.begin() ; cnts.end() != ic ; ++ic ) { stream << (*ic) << endmsg ; }
| gorup | the gorup name |
Implemented in CounterSvc.
| virtual StatusCode ICounterSvc::create | ( | const std::string & | group, | |
| const std::string & | name, | |||
| longlong | initial_value, | |||
| Counter *& | refpCounter | |||
| ) | [pure virtual] |
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.
| group | [IN] Hint for smart printing | |
| name | [IN] Counter name | |
| initial_value | [IN] Initial counter value | |
| refpCounter | [OUT] Reference to store pointer to counter. |
Implemented in CounterSvc.
| virtual CountObject ICounterSvc::create | ( | const std::string & | group, | |
| const std::string & | name, | |||
| longlong | initial_value = 0 | |||
| ) | [pure virtual] |
If the counter object exists already, a std::runtime_error exception is thrown.
The ownership of the actual counter stays with the service.
| group | [IN] Hint for smart printing | |
| name | [IN] Counter name | |
| initial_value | [IN] Initial counter value | |
| refpCounter | [OUT] Reference to store pointer to counter. |
Implemented in CounterSvc.
| virtual StatusCode ICounterSvc::remove | ( | const std::string & | group, | |
| const std::string & | name | |||
| ) | [pure virtual] |
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.
| group | [IN] Hint for smart printing | |
| name | [IN] Counter name | |
| initial_value | [IN] Initial counter value | |
| refpCounter | [OUT] Reference to store pointer to counter. |
Implemented in CounterSvc.
| virtual StatusCode ICounterSvc::remove | ( | const std::string & | group | ) | [pure virtual] |
Remove all counters of a given group.
If no such counter exists the return code is COUNTER_NOT_PRESENT
| group | [IN] Hint for smart printing |
Implemented in CounterSvc.
| virtual StatusCode ICounterSvc::print | ( | const std::string & | group, | |
| const std::string & | name, | |||
| Printout & | printer | |||
| ) | const [pure virtual] |
Print counter value.
| group | [IN] Hint for smart printing | |
| name | [IN] Counter name | |
| printer | [IN] Print actor |
Implemented in CounterSvc.
| virtual StatusCode ICounterSvc::print | ( | const std::string & | group, | |
| Printout & | printer | |||
| ) | const [pure virtual] |
If no such counter exists the return code is COUNTER_NOT_PRESENT Note: This call is not direct access.
| group | [IN] Hint for smart printing | |
| printer | [IN] Print actor |
Implemented in CounterSvc.
| virtual StatusCode ICounterSvc::print | ( | const Counter * | pCounter, | |
| Printout & | printer | |||
| ) | const [pure virtual] |
Print counter value.
| pCounter | [IN] Pointer to Counter object | |
| printer | [IN] Print actor |
Implemented in CounterSvc.
| virtual StatusCode ICounterSvc::print | ( | const CountObject & | pCounter, | |
| Printout & | printer | |||
| ) | const [pure virtual] |
Print counter value.
| refCounter | [IN] Reference to CountObject object | |
| printer | [IN] Print actor |
Implemented in CounterSvc.
| virtual StatusCode ICounterSvc::print | ( | Printout & | printer | ) | const [pure virtual] |
| printer | [IN] Print actor |
Implemented in CounterSvc.
| virtual StatusCode ICounterSvc::defaultPrintout | ( | MsgStream & | log, | |
| const Counter * | pCounter | |||
| ) | const [pure virtual] |