Scheduler
|
#include <eventList.h>
Public Types | |
typedef std::list< std::shared_ptr< Event > >::iterator | iterator |
Public Member Functions | |
std::shared_ptr< Event > | pop () |
std::shared_ptr< Event > | getHead () |
get the element at the head of the list More... | |
std::shared_ptr< Event > | insert (std::shared_ptr< Event > e) |
void | remove (std::shared_ptr< Event > e) |
remove an element from the list. More... | |
void | empty () |
bool | isEmpty () |
void | print () |
void | setRandomGenerator (Utils::RandomGenerator *gen) |
set a random generator TODO: shouldn't that be part of the constructor? More... | |
Utils::RandomGenerator * | getRandomGenerator () |
get the random generator More... | |
Static Public Member Functions | |
static EventList * | getInstance () |
Singleton pattern. More... | |
The event list contains all the events scheduled and not yet processed
Definition at line 29 of file eventList.h.
typedef std::list<std::shared_ptr<Event> >::iterator Scheduler::EventList::iterator |
Definition at line 33 of file eventList.h.
void EventList::empty | ( | ) |
Removes all elements from the list
Definition at line 104 of file eventList.cpp.
std::shared_ptr< Event > EventList::getHead | ( | ) |
get the element at the head of the list
Definition at line 124 of file eventList.cpp.
|
static |
Utils::RandomGenerator * EventList::getRandomGenerator | ( | ) |
get the random generator
NOTE: this generator can be used by the events when needed. We make it go through the event list as a way to let the SchedulingSimulator class initialize the seed. FIXME: the SchedulingSimulator also provides a rng to the Process class, but through a static member
Definition at line 42 of file eventList.cpp.
Insert an event. The position will depend on the event's time If the event's time is after the simulation's end time, the event is not inserted.
e | a pointer to the event to be inserted. If the pointer is null, nothing is inserted. |
Definition at line 56 of file eventList.cpp.
bool EventList::isEmpty | ( | ) |
Tests if the list is empty
Definition at line 98 of file eventList.cpp.
std::shared_ptr< Event > EventList::pop | ( | ) |
Removes and returns the event at the head of the list
Definition at line 47 of file eventList.cpp.
void EventList::print | ( | ) |
Print the contents of the list to standard output
Definition at line 111 of file eventList.cpp.
void EventList::remove | ( | std::shared_ptr< Event > | e | ) |
remove an element from the list.
e | pointer to an event to be removed. If the list does not contain this event, nothing happens. |
Definition at line 83 of file eventList.cpp.
void EventList::setRandomGenerator | ( | Utils::RandomGenerator * | gen | ) |
set a random generator TODO: shouldn't that be part of the constructor?
Definition at line 37 of file eventList.cpp.