Scheduler
eventList.h
Go to the documentation of this file.
1 
10 #ifndef EVENTLIST_H
11 #define EVENTLIST_H
12 
13 #include <cmath>
14 #include <list>
15 #include <memory>
16 #include <mutex>
17 
18 #include "event.h"
19 
20 namespace Utils{class RandomGenerator;}
21 
22 namespace Scheduler
23 {
24 
25 class Event;
26 
29 class EventList
30 {
31 
32 public:
33  typedef std::list<std::shared_ptr<Event>>::iterator iterator;
37  static EventList *getInstance();
42  std::shared_ptr<Event> pop();
45  std::shared_ptr<Event> getHead();
53  std::shared_ptr<Event> insert(std::shared_ptr<Event> e);
58  void remove(std::shared_ptr<Event> e);
61  void empty();
65  bool isEmpty();
68  void print();
72  void setRandomGenerator(Utils::RandomGenerator *gen);
80  Utils::RandomGenerator *getRandomGenerator();
81 private:
82  EventList();
83  static EventList *instance;
84  std::list<std::shared_ptr<Event>> list;
85  double endTime{INFINITY};
86  bool emptied{false};
87  Utils::RandomGenerator *randomGenerator;
88  static std::mutex mut;
89 };
90 
91 
92 
93 }
94 
95 
96 #endif
std::list< std::shared_ptr< Event > >::iterator iterator
Definition: eventList.h:33
Definition: context.h:16