Scheduler
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Scheduler::EventList Class Reference

#include <eventList.h>

Public Types

typedef std::list< std::shared_ptr< Event > >::iterator iterator
 

Public Member Functions

std::shared_ptr< Eventpop ()
 
std::shared_ptr< EventgetHead ()
 get the element at the head of the list More...
 
std::shared_ptr< Eventinsert (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::RandomGeneratorgetRandomGenerator ()
 get the random generator More...
 

Static Public Member Functions

static EventListgetInstance ()
 Singleton pattern. More...
 

Detailed Description

The event list contains all the events scheduled and not yet processed

Definition at line 29 of file eventList.h.

Member Typedef Documentation

typedef std::list<std::shared_ptr<Event> >::iterator Scheduler::EventList::iterator

Definition at line 33 of file eventList.h.

Member Function Documentation

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.

EventList * EventList::getInstance ( )
static

Singleton pattern.

Returns
the one and only event list

Definition at line 22 of file eventList.cpp.

Utils::RandomGenerator * EventList::getRandomGenerator ( )

get the random generator

Returns
a 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.

std::shared_ptr< Event > EventList::insert ( std::shared_ptr< Event e)

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.

Parameters
ea pointer to the event to be inserted. If the pointer is null, nothing is inserted.
Returns
the event inserted, or nullptr if the element is not inserted

Definition at line 56 of file eventList.cpp.

bool EventList::isEmpty ( )

Tests if the list is empty

Returns
true if the list is empty, false otherwise

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

Returns
the event at the head of the list (the element the closest in the future)

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.

Parameters
epointer 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.


The documentation for this class was generated from the following files: