Files
cppcourse/cmat/Ex51/TimerSet.h
T
2026-10-07 15:13:55 +02:00

34 lines
556 B
C++

#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