Counts events, forgetting old ones. Usefull for "3 errors/minute" limits. More...

#include <FadingCounter.h>

Collaboration diagram for FadingCounter:

Public Member Functions

 FadingCounter ()
 
void configure (double horizonSeconds)
 0=remember nothing; -1=forget nothing; new value triggers clear() More...
 
void clear ()
 forgets all events More...
 
int count (int howMany)
 count fresh, return #events remembered More...
 
int remembered () const
 possibly stale #events More...
 

Public Attributes

double horizon
 read-only memory horizon in seconds; older events are forgotten More...
 

Private Attributes

const int precision
 #counting slots, controls measur. occuracy More...
 
double delta
 sub-interval duration = horizon/precision More...
 
double lastTime
 time of the last update More...
 
std::vector< intcounters
 events per delta (possibly stale) More...
 
int total
 number of remembered events (possibly stale) More...
 

Detailed Description

Definition at line 15 of file FadingCounter.h.

Constructor & Destructor Documentation

FadingCounter::FadingCounter ( )

Definition at line 16 of file FadingCounter.cc.

References counters, and precision.

Member Function Documentation

void FadingCounter::clear ( )

Definition at line 24 of file FadingCounter.cc.

References counters, current_dtime, i, lastTime, precision, and total.

Referenced by configure(), and count().

void FadingCounter::configure ( double  horizonSeconds)

Definition at line 32 of file FadingCounter.cc.

References clear(), delta, horizon, and precision.

Referenced by Ssl::ClientBio::ClientBio().

int FadingCounter::count ( int  howMany)

Definition at line 41 of file FadingCounter.cc.

References clear(), counters, current_dtime, delta, horizon, i, lastTime, Must, precision, and total.

int FadingCounter::remembered ( ) const
inline

Definition at line 26 of file FadingCounter.h.

References total.

Member Data Documentation

std::vector<int> FadingCounter::counters
private

Definition at line 36 of file FadingCounter.h.

Referenced by clear(), count(), and FadingCounter().

double FadingCounter::delta
private

Definition at line 33 of file FadingCounter.h.

Referenced by configure(), and count().

double FadingCounter::horizon

Definition at line 29 of file FadingCounter.h.

Referenced by configure(), and count().

double FadingCounter::lastTime
private

Definition at line 35 of file FadingCounter.h.

Referenced by clear(), and count().

const int FadingCounter::precision
private

Definition at line 32 of file FadingCounter.h.

Referenced by clear(), configure(), count(), and FadingCounter().

int FadingCounter::total
private

Definition at line 37 of file FadingCounter.h.

Referenced by clear(), count(), and remembered().


The documentation for this class was generated from the following files:

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors