ANNA Suite  2020b
Multipurpose development suite for Telco applications
Counter.hpp
Go to the documentation of this file.
1 // ANNA - Anna is Not Nothingness Anymore //
2 // //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
4 // //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
7 
8 
9 #ifndef anna_core_oam_Counter_hpp
10 #define anna_core_oam_Counter_hpp
11 
13 
14 namespace anna {
15 
16 namespace oam {
17 
18 class CounterScope;
19 
25 class Counter {
26 public:
27  typedef unsigned int type_t;
28 
34  const std::string& getName() const { return a_name; }
35 
42  int getReference() const ;
43 
49  type_t getValue() const { return a_value; }
50 
55  U64 getAccumulatedValue() const { return a_accValue; }
56 
61  operator type_t () const { return a_value; }
62 
66  void reset() { a_value = 0; }
67 
72  bool resetAcc() { bool result = (a_accValue != 0); a_accValue = 0; return result; }
73 
74 
79  std::string asString() const ;
80 
81 private:
82  CounterScope& a_scope;
83  const int a_id;
84  std::string a_name;
85  type_t a_value;
86  U64 a_accValue;
87 
88  Counter(CounterScope& scope, const int id, const char* name);
89  Counter(const Counter&);
90 
91  void debug() const ;
92 
93  friend class CounterScope;
94 };
95 
96 }
97 }
98 
99 #endif
100 
bool resetAcc()
Definition: Counter.hpp:72
const std::string & getName() const
Definition: Counter.hpp:34
U64 getAccumulatedValue() const
Definition: Counter.hpp:55
std::string asString() const
Definition: Counter.hpp:25
unsigned int type_t
Definition: Counter.hpp:27
int getReference() const
type_t getValue() const
Definition: Counter.hpp:49
Definition: CounterScope.hpp:32
Definition: app.hpp:12
uint64_t U64
Definition: defines.hpp:81
void reset()
Definition: Counter.hpp:66