#include <filters.h>
Public Member Functions | |
| _ExponentialFilter (_T FilteringCoef) | |
| void | ResetValue (_T Value) |
| Forcibly resets the filtered value. | |
| void | SetCoef (_T Coef) |
| Updates the filtering coefficient. | |
| _T | UpdateValue (_T Value) |
| Takes the new value and returns the filtered one. | |
| _T | GetValue () |
| Returns last filtered value. | |
Private Attributes | |
| _T | m_Value |
| _T | m_FilteringCoef |
The _ExponentialFilter template allows filtering some set of values according to the exponential law (value = old + delta * coef, where coef < 1)
| _T | Represents value type. Can be double, int, LONGLONG, etc. | |
| _Divider | Represents the divider part of the coefficient the multiplier is specified on construction and can be changed during operation. The real coefficient is determined as Coef / _Divider. This parameter allows avoiding floating point operations for integer data types by specifying filtering coefficient as integer divided by constant integer (template parameter). |
ExponentialFilterI32 filter(500); //500/1000 means 1/2, 1000 is the divider set for ExponentialFilterI32
...
for (...)
{
...
int val = GetNextValue();
val = filter.UpdateValue(val);
DoSomethingWithNextValue(val);
...
}
| BazisLib::_ExponentialFilter< _T, _Divider >::_ExponentialFilter | ( | _T | FilteringCoef | ) | [inline] |
| _T BazisLib::_ExponentialFilter< _T, _Divider >::GetValue | ( | ) | [inline] |
Returns last filtered value.
| void BazisLib::_ExponentialFilter< _T, _Divider >::ResetValue | ( | _T | Value | ) | [inline] |
Forcibly resets the filtered value.
| void BazisLib::_ExponentialFilter< _T, _Divider >::SetCoef | ( | _T | Coef | ) | [inline] |
Updates the filtering coefficient.
This method updates the filtering coefficient.
| Coef | Specifies the coefficient. The real one equals to Coef / _Divider, where _Divider is the template parameter. |
| _T BazisLib::_ExponentialFilter< _T, _Divider >::UpdateValue | ( | _T | Value | ) | [inline] |
Takes the new value and returns the filtered one.
_T BazisLib::_ExponentialFilter< _T, _Divider >::m_FilteringCoef [private] |
_T BazisLib::_ExponentialFilter< _T, _Divider >::m_Value [private] |