kanzi::SpeedMeasurer Class Reference

Implements an object that calculates average speed from its measurement data. More...

#include <kanzi/core.ui/util/speed_measurer.hpp>

Public Member Functions

 SpeedMeasurer (size_t maxMeasurements, chrono::milliseconds minMeasurementWindow, chrono::milliseconds maxMeasurementWindow)
 Creates a speed measurer with the given properties. More...
 
void reset ()
 Resets measurement data. More...
 
void addMeasurement (chrono::milliseconds timestamp, float value)
 Adds a new measurement to the measurer. More...
 
optional< float > getSpeed (chrono::milliseconds measurementTime) const
 Calculates average speed from measurements in units / second. More...
 

Detailed Description

Implements an object that calculates average speed from its measurement data.

Constructor & Destructor Documentation

kanzi::SpeedMeasurer::SpeedMeasurer ( size_t  maxMeasurements,
chrono::milliseconds  minMeasurementWindow,
chrono::milliseconds  maxMeasurementWindow 
)
explicit

Creates a speed measurer with the given properties.

Member Function Documentation

void kanzi::SpeedMeasurer::reset ( )

Resets measurement data.

void kanzi::SpeedMeasurer::addMeasurement ( chrono::milliseconds  timestamp,
float  value 
)

Adds a new measurement to the measurer.

optional<float> kanzi::SpeedMeasurer::getSpeed ( chrono::milliseconds  measurementTime) const

Calculates average speed from measurements in units / second.

Returns nullopt if there were not enough measurements.


The documentation for this class was generated from the following file: