31 lines
606 B
C++
31 lines
606 B
C++
#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; // 3.1 bonus: change from array to vector
|
|
// int timersInUse; // 3.1 bonus: Not needed
|
|
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
|