Hotwheels-Cluster 1.2
Creation of Cluster APP for SEA:ME project.
 
Loading...
Searching...
No Matches
MileageCalculator Class Reference

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.
 
- Public Member Functions inherited from IMileageCalculator
virtual ~IMileageCalculator ()=default
 

Private Attributes

QList< QPair< float, qint64 > > m_speedValues
 
QElapsedTimer m_intervalTimer
 

Detailed Description

Class that calculates the total distance traveled based on speed measurements.

Definition at line 28 of file MileageCalculator.hpp.

Constructor & Destructor Documentation

◆ MileageCalculator()

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.

◆ ~MileageCalculator()

MileageCalculator::~MileageCalculator ( )
default

Member Function Documentation

◆ addSpeed()

void MileageCalculator::addSpeed ( float speed)
overridevirtual

Add a speed value to the calculator.

Parameters
speedThe 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.

◆ calculateDistance()

double MileageCalculator::calculateDistance ( )
overridevirtual

Calculate the distance traveled by the vehicle.

Returns
double 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.

Field Documentation

◆ m_intervalTimer

QElapsedTimer MileageCalculator::m_intervalTimer
private

Definition at line 38 of file MileageCalculator.hpp.

◆ m_speedValues

QList<QPair<float, qint64> > MileageCalculator::m_speedValues
private

Definition at line 37 of file MileageCalculator.hpp.


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