Hotwheels-Cluster 1.2
Creation of Cluster APP for SEA:ME project.
 
Loading...
Searching...
No Matches
MileageManager.hpp
Go to the documentation of this file.
1
15
16#ifndef MILEAGEMANAGER_HPP
17#define MILEAGEMANAGER_HPP
18
19#include <QObject>
20#include <QTimer>
23
28class MileageManager : public QObject {
29 Q_OBJECT
30
31public:
32 explicit MileageManager(const QString &filePath,
33 IMileageCalculator *calculator = nullptr,
34 IMileageFileHandler *fileHandler = nullptr,
35 QObject *parent = nullptr);
37 void initialize();
38 void shutdown();
39
40 double getTotalMileage() const { return this->m_totalMileage; };
41
42public slots:
43 void onSpeedUpdated(float speed);
44 void updateMileage();
45 void saveMileage();
46
47signals:
48 void mileageUpdated(double mileage);
49
50private:
58};
59
60#endif // MILEAGEMANAGER_HPP
Definition of the IMileageCalculator interface.
Definition of the IMileageFileHandler interface.
Interface for calculating the mileage of a vehicle.
Interface for reading and writing the mileage of a vehicle to a file.
MileageManager(const QString &filePath, IMileageCalculator *calculator=nullptr, IMileageFileHandler *fileHandler=nullptr, QObject *parent=nullptr)
Constructs a MileageManager object with the specified file path, calculator, and file handler.
IMileageCalculator * m_calculator
double getTotalMileage() const
void updateMileage()
Updates the mileage.
void mileageUpdated(double mileage)
void shutdown()
Shuts down the MileageManager object.
void initialize()
Initializes the MileageManager object.
void saveMileage()
Saves the mileage to the file.
~MileageManager()
Destructs the MileageManager object.
IMileageFileHandler * m_fileHandler
void onSpeedUpdated(float speed)
Handles the speed updated signal.