MovingAverage: nelems of zero is not allowed
This commit is contained in:
@@ -4,7 +4,13 @@
|
||||
#include <cmath>
|
||||
#include "MovingAverage.h"
|
||||
|
||||
MovingAverage::MovingAverage(size_t elems) : elems(elems) {}
|
||||
#include "JFJochException.h"
|
||||
|
||||
MovingAverage::MovingAverage(size_t elems) : elems(elems) {
|
||||
if (elems == 0)
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Moving average size must be positive");
|
||||
|
||||
}
|
||||
|
||||
void MovingAverage::Add(float val) {
|
||||
std::unique_lock ul(m);
|
||||
|
||||
Reference in New Issue
Block a user