All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ICounterSvc.h
Go to the documentation of this file.
1 // $Id: ICounterSvc.h,v 1.4 2007/08/06 08:39:40 marcocle Exp $
2 // ============================================================================
3 // CVS tag $Name: $, version $Revision: 1.4 $
4 // ============================================================================
5 #ifndef GAUDIKERNEL_ICOUNTERSVC_H
6 #define GAUDIKERNEL_ICOUNTERSVC_H
7 // ============================================================================
8 // Include files
9 // ============================================================================
10 // STD & STL
11 // ============================================================================
12 #include <string>
13 #include <vector>
14 // ============================================================================
15 // GaudiKernel
16 // ============================================================================
17 #include "GaudiKernel/IInterface.h"
18 #include "GaudiKernel/StatEntity.h"
19 #include "GaudiKernel/Stat.h"
20 // ============================================================================
21 // Forward declarations
22 // ============================================================================
23 class MsgStream ;
24 class StatEntity ;
25 class ICounterSvc ;
26 // ============================================================================
78 class GAUDI_API ICounterSvc: virtual public IInterface
79 {
80 public:
84  typedef StatEntity Counter ;
100  typedef Stat CountObject ;
102  typedef std::vector<CountObject> Counters ;
111  class Printout
112  {
113  public:
115  Printout ( ICounterSvc* svc ) ;
117  ~Printout () ;
119  StatusCode operator()( MsgStream& log , const Counter* cnt ) const ;
120  private:
121  // no defauld constructor
122  Printout () ;
123  // no copy
124  Printout ( const Printout& ) ; //< no coy constructor
125  // no assignement
126  Printout& operator=( const Printout& ) ;
127  private:
130  } ;
139  virtual Counter* get
140  ( const std::string& group ,
141  const std::string& name ) const = 0;
160  virtual Counters get ( const std::string& group ) const = 0 ;
173  virtual StatusCode create
174  ( const std::string& group ,
175  const std::string& name ,
176  longlong initial_value ,
177  Counter*& refpCounter ) = 0;
187  virtual CountObject create
188  ( const std::string& group ,
189  const std::string& name ,
190  longlong initial_value = 0 ) = 0;
200  virtual StatusCode remove
201  ( const std::string& group ,
202  const std::string& name ) = 0;
208  virtual StatusCode remove
209  ( const std::string& group ) = 0;
217  virtual StatusCode print
218  ( const std::string& group ,
219  const std::string& name ,
220  Printout& printer ) const = 0;
227  virtual StatusCode print
228  ( const std::string& group ,
229  Printout& printer ) const = 0;
235  virtual StatusCode print
236  ( const Counter* pCounter ,
237  Printout& printer ) const = 0;
243  virtual StatusCode print
244  ( const CountObject& pCounter ,
245  Printout& printer ) const = 0;
249  virtual StatusCode print
250  ( Printout& printer ) const = 0;
252  virtual StatusCode defaultPrintout
253  ( MsgStream& log ,
254  const Counter* pCounter ) const = 0;
255  // Return codes:
256  enum { COUNTER_NOT_PRESENT = 2, // Error
257  COUNTER_EXISTS = 4, // Error ?
258  COUNTER_REMOVED = 3 // Type of success. Low bit set
259  } ;
260 protected:
262  virtual ~ICounterSvc() ;
263 };
264 // ============================================================================
266 // ============================================================================
267 std::ostream& operator<<( std::ostream& , const ICounterSvc::CountObject& ) ;
268 // ============================================================================
270 // ============================================================================
271 #endif // GAUDIKERNEL_ICOUNTERSVC_H
272 // ============================================================================
Definition of the MsgStream class used to transmit messages.
Definition: MsgStream.h:24
ICounterSvc * m_svc
Reference to counter service.
Definition: ICounterSvc.h:129
Small wrapper class for easy manipulation with generic counters and IStatSvc&ICounterSvc interface...
Definition: Stat.h:50
Create / access multi purpose counters.
Definition: ICounterSvc.h:78
std::vector< CountObject > Counters
the actual type of vectors of initialized counters
Definition: ICounterSvc.h:102
StatEntity Counter
the actual type of counter
Definition: ICounterSvc.h:84
Print counters for each element in the range [first, last) e.g.
Definition: ICounterSvc.h:111
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
Definition of the basic interface.
Definition: IInterface.h:160
#define DeclareInterfaceID(name, major, minor)
Macro to declare the interface ID when using the new mechanism of extending and implementing interfac...
Definition: IInterface.h:23
Stat CountObject
Ease the manipulation of counters in a way, that they behave like objects: Avoid: Counter* cnt = ...
Definition: ICounterSvc.h:100
std::ostream & operator<<(std::ostream &, const ICounterSvc::CountObject &)
output operator for the counter object
Definition: Stat.cpp:235
The basic counter used for Monitoring purposes.
Definition: StatEntity.h:68
#define GAUDI_API
Definition: Kernel.h:108