initial commit

This commit is contained in:
kazu
2017-07-15 15:52:05 +02:00
parent 087def3773
commit fb0ff1c076
16 changed files with 1857 additions and 1 deletions

38
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