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/StatEntity.h"
16 #include "GaudiKernel/SmartIF.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:
81  typedef StatEntity Counter ;
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
133  ( const std::string& group ,
134  const std::string& name ) const = 0;
153  virtual Counters get ( const std::string& group ) const = 0 ;
166  virtual StatusCode create
167  ( const std::string& group ,
168  const std::string& name ,
169  longlong initial_value ,
170  Counter*& refpCounter ) = 0;
180  virtual CountObject create
181  ( const std::string& group ,
182  const std::string& name ,
183  longlong initial_value = 0 ) = 0;
193  virtual StatusCode remove
194  ( const std::string& group ,
195  const std::string& name ) = 0;
201  virtual StatusCode remove
202  ( const std::string& group ) = 0;
210  virtual StatusCode print
211  ( const std::string& group ,
212  const std::string& name ,
213  Printout& printer ) const = 0;
220  virtual StatusCode print
221  ( const std::string& group ,
222  Printout& printer ) const = 0;
228  virtual StatusCode print
229  ( const Counter* pCounter ,
230  Printout& printer ) const = 0;
236  virtual StatusCode print
237  ( const CountObject& pCounter ,
238  Printout& printer ) const = 0;
242  virtual StatusCode print
243  ( Printout& printer ) const = 0;
245  virtual StatusCode defaultPrintout
246  ( MsgStream& log ,
247  const Counter* pCounter ) const = 0;
248  // Return codes:
249  enum { COUNTER_NOT_PRESENT = 2, // Error
250  COUNTER_EXISTS = 4, // Error ?
251  COUNTER_REMOVED = 3 // Type of success. Low bit set
252  } ;
253 };
254 // ============================================================================
256 // ============================================================================
258 // ============================================================================
260 // ============================================================================
261 #endif // GAUDIKERNEL_ICOUNTERSVC_H
262 // ============================================================================
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
#define DeclareInterfaceID(iface, major, minor)
Macro to declare the interface ID when using the new mechanism of extending and implementing interfac...
Definition: IInterface.h:14
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:26
Definition of the basic interface.
Definition: IInterface.h:234
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:33
std::ostream & operator<<(std::ostream &, const ICounterSvc::CountObject &)
output operator for the counter object
Definition: Stat.cpp:181
The basic counter used for Monitoring purposes.
Definition: StatEntity.h:64
#define GAUDI_API
Definition: Kernel.h:107
STL class.