feat(cmat): Completed Ex51

This commit is contained in:
2026-10-07 15:13:55 +02:00
parent a65e84e796
commit 058179b643
3 changed files with 96 additions and 85 deletions
+33 -29
View File
@@ -1,29 +1,33 @@
#ifndef TIMERSET_H
#define TIMERSET_H
#include <ctime>
#include <vector>
class Timer;
class TimerSet {
public:
void pollAllTimers();
void addATimer(Timer *);
private:
TimerSet();
std::vector<Timer *> timers;
std::time_t previousTime;
// Meyer's singleton
public:
static TimerSet &Instance();
private:
// prevent copying and assignment of the singleton
TimerSet(const TimerSet &);
TimerSet &operator=(const TimerSet &);
};
#endif
#ifndef TIMERSET_H
#define TIMERSET_H
#include <ctime>
#include <vector>
#include <thread>
class Timer;
class TimerSet {
public:
void pollAllTimers();
void addATimer(Timer *);
private:
TimerSet();
std::vector<Timer *> timers;
std::time_t previousTime;
std::thread pollingThread;
// Meyer's singleton
public:
static TimerSet &Instance();
private:
// prevent copying and assignment of the singleton
TimerSet(const TimerSet &);
TimerSet &operator=(const TimerSet &);
void poll10Hz();
};
#endif