current version.. forgot to commit

This commit is contained in:
2018-02-03 21:02:04 +01:00
parent fb0ff1c076
commit 431436a822
17 changed files with 599 additions and 101 deletions

38
lib/EndlessAVG.h Executable file
View File

@@ -0,0 +1,38 @@
#ifndef ENDLESSAVG_H
#define ENDLESSAVG_H
template <typename T> class EndlessAVG {
private:
/** track the current sum of the vector's values */
T curSum;
/** the number of elements to average */
int count;
public:
/** ctor */
EndlessAVG() : curSum(), count(0) {;}
/** add a new value */
void add(const T val) {
curSum += val;
++count;
}
/** get the current average */
T get() const {
return curSum / count;
}
/** get number of entries to average */
int getSize() const {
return count;
}
};
#endif // ENDLESSAVG_H