29 lines
545 B
C++
29 lines
545 B
C++
#ifndef SCHEDULER_HPP
|
|
#define SCHEDULER_HPP
|
|
|
|
#include <ctime>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
class Timer {
|
|
public:
|
|
Timer(std::string name, float max_time) : name(name), max_time(max_time) {};
|
|
bool below_or_zero();
|
|
float get_time();
|
|
std::string get_name();
|
|
void reset();
|
|
void update();
|
|
|
|
private:
|
|
float time = 0;
|
|
const float max_time;
|
|
const std::string name;
|
|
};
|
|
|
|
struct Scheduler {
|
|
std::vector<Timer> timers;
|
|
void update(bool& running, std::vector<Timer>& times);
|
|
int pull(std::vector<Timer>& times, std::string name);
|
|
};
|
|
#endif
|