Class that calculates the total distance traveled based on speed measurements. More...
#include <MileageCalculator.hpp>
Public Member Functions | |
MileageCalculator () | |
Construct a new MileageCalculator object. | |
~MileageCalculator ()=default | |
void | addSpeed (float speed) override |
Add a speed value to the calculator. | |
double | calculateDistance () override |
Calculate the distance traveled by the vehicle. | |
![]() | |
virtual | ~IMileageCalculator ()=default |
Private Attributes | |
QList< QPair< float, qint64 > > | m_speedValues |
QElapsedTimer | m_intervalTimer |
Class that calculates the total distance traveled based on speed measurements.
Definition at line 28 of file MileageCalculator.hpp.
MileageCalculator::MileageCalculator | ( | ) |
Construct a new MileageCalculator object.
This constructor initializes the MileageCalculator object with a started interval timer.
Definition at line 27 of file MileageCalculator.cpp.
|
default |
|
overridevirtual |
Add a speed value to the calculator.
speed | The speed value to add. |
This function adds a speed value to the calculator with the current interval time.
Implements IMileageCalculator.
Definition at line 35 of file MileageCalculator.cpp.
|
overridevirtual |
Calculate the distance traveled by the vehicle.
This function calculates the distance traveled by the vehicle based on the speed values received.
Implements IMileageCalculator.
Definition at line 54 of file MileageCalculator.cpp.
|
private |
Definition at line 38 of file MileageCalculator.hpp.
|
private |
Definition at line 37 of file MileageCalculator.hpp.