The Gaudi Framework  v29r0 (ff2e7097)
ICounterSvc.h
Go to the documentation of this file.
1 // ============================================================================
2 #ifndef GAUDIKERNEL_ICOUNTERSVC_H
3 #define GAUDIKERNEL_ICOUNTERSVC_H
4 // ============================================================================
5 // Include files
6 // ============================================================================
7 // STD & STL
8 // ============================================================================
9 #include <string>
10 #include <vector>
11 // ============================================================================
12 // GaudiKernel
13 // ============================================================================
14 #include "GaudiKernel/IInterface.h"
15 #include "GaudiKernel/SmartIF.h"
16 #include "GaudiKernel/StatEntity.h"
17 // ============================================================================
18 // Forward declarations
19 // ============================================================================
20 class MsgStream;
21 class StatEntity;
22 class Stat;
23 // ============================================================================
75 class GAUDI_API ICounterSvc : virtual public IInterface
76 {
77 public:
97  typedef Stat CountObject;
108  class Printout final
109  {
110  public:
112  Printout( ICounterSvc* svc );
114  StatusCode operator()( MsgStream& log, const Counter* cnt ) const;
115 
116  // no default,copy constructor, assignment
117  Printout() = delete;
118  Printout( const Printout& ) = delete; //< no copy constructor
119  Printout& operator=( const Printout& ) = delete;
120  private:
123  };
132  virtual Counter* get( const std::string& group, const std::string& name ) const = 0;
151  virtual Counters get( const std::string& group ) const = 0;
164  virtual StatusCode create( const std::string& group, const std::string& name, longlong initial_value,
165  Counter*& refpCounter ) = 0;
175  virtual CountObject create( const std::string& group, const std::string& name, longlong initial_value = 0 ) = 0;
185  virtual StatusCode remove( const std::string& group, const std::string& name ) = 0;
191  virtual StatusCode remove( const std::string& group ) = 0;
199  virtual StatusCode print( const std::string& group, const std::string& name, Printout& printer ) const = 0;
206  virtual StatusCode print( const std::string& group, Printout& printer ) const = 0;
212  virtual StatusCode print( const Counter* pCounter, Printout& printer ) const = 0;
218  virtual StatusCode print( const CountObject& pCounter, Printout& printer ) const = 0;
222  virtual StatusCode print( Printout& printer ) const = 0;
224  virtual StatusCode defaultPrintout( MsgStream& log, const Counter* pCounter ) const = 0;
225  // Return codes:
226  enum {
227  COUNTER_NOT_PRESENT = 2, // Error
228  COUNTER_EXISTS = 4, // Error ?
229  COUNTER_REMOVED = 3 // Type of success. Low bit set
230  };
231 };
232 // ============================================================================
234 // ============================================================================
236 // ============================================================================
238 // ============================================================================
239 #endif // GAUDIKERNEL_ICOUNTERSVC_H
240 // ============================================================================
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
Small wrapper class for easy manipulation with generic counters and IStatSvc&ICounterSvc interface...
Definition: Stat.h:46
Create / access multi purpose counters.
Definition: ICounterSvc.h:75
SmartIF< ICounterSvc > m_svc
Reference to counter service.
Definition: ICounterSvc.h:122
std::vector< CountObject > Counters
the actual type of vectors of initialized counters
Definition: ICounterSvc.h:99
StatEntity Counter
the actual type of counter
Definition: ICounterSvc.h:81
PropertyMgr & operator=(const PropertyMgr &)=delete
STL class.
Print counters for each element in the range [first, last) e.g.
Definition: ICounterSvc.h:108
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
#define DeclareInterfaceID(iface, major, minor)
Macro to declare the interface ID when using the new mechanism of extending and implementing interfac...
Definition: IInterface.h:13
Definition of the basic interface.
Definition: IInterface.h:277
Stat CountObject
Ease the manipulation of counters in a way, that they behave like objects: Avoid: Counter* cnt = ...
Definition: ICounterSvc.h:97
STL class.
virtual Out operator()(const vector_of_const_< In > &inputs) const =0
void print(string text)
Definition: mergesort.cpp:30
std::ostream & operator<<(std::ostream &, const ICounterSvc::CountObject &)
output operator for the counter object
Definition: Stat.cpp:175
The basic counter used for Monitoring purposes.
Definition: StatEntity.h:65
#define GAUDI_API
Definition: Kernel.h:110
STL class.