A flow rate filter measures the flow rate of incoming data.
More...
#include <SoftFilters.h>
|
virtual void const *const | get_output_val_ptr () override |
| Read-only access to the internal output memory. More...
|
|
virtual void | copy_to_client (void *const output) override |
| Copy the output to client memory.
|
|
T const * | ptr |
| Pointer to the latest data that passed through.
|
|
template<typename T, typename TS_T, TS_T(*)() time_fun, TS_T TICKS_PER_SEC>
class FlowRateFilter< T, TS_T, time_fun, TICKS_PER_SEC >
A flow rate filter measures the flow rate of incoming data.
- Template Parameters
-
T | The type of the data that is passing through. |
TS_T | The type of timestamp. Defaults to unsigned long as per documentation of the Arduino millis and micros functions. |
time_fun | A timestamp function that takes no input parameter and returns a timestamp in the unit of number of ticks. |
TICKS_PER_SEC | Number of ticks (unit of the timestamp) per second. |
◆ get_count()
template<typename T , typename TS_T , TS_T(*)() time_fun, TS_T TICKS_PER_SEC>
unsigned long FlowRateFilter< T, TS_T, time_fun, TICKS_PER_SEC >::get_count |
( |
| ) |
|
|
inline |
- Returns
- The total number of data that have passed through this filter.
◆ get_duration_in_seconds()
template<typename T , typename TS_T , TS_T(*)() time_fun, TS_T TICKS_PER_SEC>
double FlowRateFilter< T, TS_T, time_fun, TICKS_PER_SEC >::get_duration_in_seconds |
( |
| ) |
|
|
inline |
- Returns
- The total number of seconds since arrival of the first data.
◆ get_duration_in_ticks()
template<typename T , typename TS_T , TS_T(*)() time_fun, TS_T TICKS_PER_SEC>
TS_T FlowRateFilter< T, TS_T, time_fun, TICKS_PER_SEC >::get_duration_in_ticks |
( |
| ) |
|
|
inline |
- Returns
- The total number of clock "ticks" (platform-dependent) since arrival of the first data.
◆ get_flow_rate()
template<typename T , typename TS_T , TS_T(*)() time_fun, TS_T TICKS_PER_SEC>
double FlowRateFilter< T, TS_T, time_fun, TICKS_PER_SEC >::get_flow_rate |
( |
| ) |
|
|
inline |
Calculate the data rate in "frames per second".
Essentially the "framerate" is calculated as the total number of data devided by the total duration in seconds since arrival of the first data.
- Returns
- The data per second in double precision.
◆ update()
template<typename T , typename TS_T , TS_T(*)() time_fun, TS_T TICKS_PER_SEC>
virtual bool FlowRateFilter< T, TS_T, time_fun, TICKS_PER_SEC >::update |
( |
void const *const |
input | ) |
|
|
inlineoverridevirtual |
Internally update the filter output based on the given input.
This method behaves similarly to the public Filter::push method, but without copying the output to the client memory. This method is for internal workings of the filter framework.
Reimplemented from PassThroughFilter< T >.
The documentation for this class was generated from the following file: