BoosterSeat
0.1
A C++ library that includes common utilities that are used in other projects.
|
A simple counting filter that allows for some noise. More...
#include <filters.hpp>
Public Member Functions | |
ConsecutiveValuesFilter (T initial_value, size_t filter_threshold=0) | |
Constructor for the ConsecutiveValuesFilter. More... | |
~ConsecutiveValuesFilter ()=default | |
Destructor for the ConsecutiveValuesFilter. More... | |
bool | addValue (T value) |
The input stream for this filter. More... | |
T | getCurrentValue () const |
Returns the current value. More... | |
void | reset (T value) |
Resets the filter's counter and sets the current value. More... | |
void | setFilterThreshold (size_t filter_threshold) |
Private Attributes | |
size_t | current_count_ {0} |
The current count of consecutive new values. More... | |
T | current_value_ {} |
The current value. More... | |
size_t | filter_threshold_ |
The filter threshold. More... | |
T | new_value_ {} |
The new value that is being counted. More... | |
A simple counting filter that allows for some noise.
T | The type of data to filter (enumerations generally). |
|
inline |
Constructor for the ConsecutiveValuesFilter.
initial_value | The initial value to set the filter to. |
filter_threshold | The number of consecutive values that must be seen before the filter will pass the value. |
|
default |
Destructor for the ConsecutiveValuesFilter.
|
inline |
Resets the filter's counter and sets the current value.
value | The value to set the current value to. |
References bst::ConsecutiveValuesFilter< T >::current_count_, and bst::ConsecutiveValuesFilter< T >::current_value_.
|
inline |
|
inline |
The input stream for this filter.
value | The input |
true
if the filtered value has changed, false
otherwise. References bst::ConsecutiveValuesFilter< T >::current_count_, bst::ConsecutiveValuesFilter< T >::current_value_, bst::ConsecutiveValuesFilter< T >::filter_threshold_, and bst::ConsecutiveValuesFilter< T >::new_value_.
|
inline |
Returns the current value.
References bst::ConsecutiveValuesFilter< T >::current_value_.
|
private |
The filter threshold.
Referenced by bst::ConsecutiveValuesFilter< T >::addValue(), and bst::ConsecutiveValuesFilter< T >::setFilterThreshold().
|
private |
The current count of consecutive new values.
Referenced by bst::ConsecutiveValuesFilter< T >::addValue(), and bst::ConsecutiveValuesFilter< T >::reset().
|
private |
The current value.
Referenced by bst::ConsecutiveValuesFilter< T >::addValue(), bst::ConsecutiveValuesFilter< T >::getCurrentValue(), and bst::ConsecutiveValuesFilter< T >::reset().
|
private |
The new value that is being counted.
Referenced by bst::ConsecutiveValuesFilter< T >::addValue().