Sliding Average Class
Sliding Average Time Class
Runs a series of tests a SlidingAverage of the given type and size Template function so no code will be generated unless in debug mode.
Boost Software License Version 1.0. See LICENSE_BOOST.txt for details. Alternatively, this file may be distributed under the terms of the Tango 3-Clause BSD License (see LICENSE_BSD.txt for details).
Copyright (c) 2009-2016 dunnhumby Germany GmbH. All rights reserved.
Sliding Average Module
This module contains two classes to calculate the average of a fixed amount of values. Once the fixed amount of values has been added, each time a new value is added, the oldest is forgotten
SlidingAverage is very simple. You can add values to the list and you can query the average at any time.
SlidingAverageTime offers a few more functions. It is for the use case when you don't want to add one value at once, but instead add on top of the last value until push() is called, which should be done periodically. The class is aware of that period and adjusts the added values accordingly. You tell it how much time a single completed value corresponds to and what time output resultion you desire.