#include <Counter.h>
Public Member Functions | |
| Counter () | |
| bool | Add () |
| Returns true progressively less and less often. | |
| void | Reset (int count=0) |
| Reset the counter. | |
| int | GetCount () |
| Get counter's current value;. | |
Private Attributes | |
| int | fCount |
| int | fMult |
This maintains a simple counter. To increment the counter call Add(). It's return value can be used to perform some action in a progressively more infrequent manner. It will return true for the first 10 counts, then every 10th count until reaching 100, then every 100th until reaching 1000, etc.
Created on: Mon Dec 19 18:38:37 2005
Definition at line 33 of file Counter.h.
|
|
Definition at line 3 of file Counter.cxx.
|
|
|
Returns true progressively less and less often.
Definition at line 5 of file Counter.cxx. 00006 {
00007 ++fCount;
00008 if (fCount>fMult*10) fMult *= 10;
00009 if (fCount%fMult == 0) return true;
00010 return false;
00011 }
|
|
|
Get counter's current value;.
Definition at line 18 of file Counter.cxx. 00019 {
00020 return fCount;
00021 }
|
|
|
Reset the counter.
Definition at line 12 of file Counter.cxx. References count, fCount, and fMult.
|
|
|
|
|
|
|
1.3.9.1