Scheduler
event.cpp
Go to the documentation of this file.
1 
10 #include "coreEvents.h"
11 
12 #include <fstream>
13 #include <iomanip>
14 #include <iostream>
15 
16 
17 #include "eventList.h"
18 #include "eventType.h"
19 #include <scheduler/process.h>
20 
21 using namespace Scheduler;
22 
23 Event::Event(double t, bool r) : time(t), renew(r)
24 {
25 }
26 
28 {
29 }
30 
31 void Event::setTask(std::shared_ptr<Process> p)
32 {
33  task = p;
34 }
35 
37 {
38  return time;
39 }
40 
42 {
43 #ifdef PRINT
44  if (eventType == nothing)
45  return;
46  std::cout << std::fixed << std::setfill(' ') << std::setw(7) << std::setprecision(3)<< getTime() <<": ";
47  if (task != nullptr)
48  {
49  std::cout << " Task"<<std::setfill(' ') << std::setw(3) << task->getPid();
50  if (task->isRealTime())
51  {
52  std::cout << ":"<<task->getJobNumber();
53  }
54  std::cout << ": ";
55  }
56  std::cout << getName()<<"\n";
57 #endif
58 }
59 
std::shared_ptr< Process > task
Definition: event.h:60
virtual void print()
print information about the event
Definition: event.cpp:41
list time
Definition: aging.py:11
Event(double time, bool renew=true)
Event constructor.
Definition: event.cpp:23
TriggeringEvent eventType
The event type is need by the scheduling discipline, to determine if this kind of event triggers invo...
Definition: event.h:64
virtual ~Event()
Definition: event.cpp:27
double getTime()
get the time at which the event is scheduled
Definition: event.cpp:36
virtual std::string getName()=0
get the name of the event
void setTask(std::shared_ptr< Process > task)
if the event is specific to a task, set it here. TODO not all events have an associated task...
Definition: event.cpp:31
double time
Definition: event.h:58