forked from SWE501-Spring2017-Bogazici/FinalProject
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOutputDevice.cpp
More file actions
72 lines (55 loc) · 1.35 KB
/
OutputDevice.cpp
File metadata and controls
72 lines (55 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*
* OutputDevice.cpp
*
* Created on: Jun 2, 2017
* Author: Can Candan
*/
#include "OutputDevice.h"
#include "OutFreeEvent.h"
#include "easylogging++.h"
OutputDevice::OutputDevice() {
// TODO Auto-generated constructor stub
}
OutputDevice::OutputDevice(int id, double quantum) : id(id), quantum(quantum) {
activeTime=0.0;
}
Simulation* OutputDevice::getSim() const {
return sim;
}
void OutputDevice::setSim(Simulation* sim) {
this->sim = sim;
}
OutputDevice::~OutputDevice() {
// TODO Auto-generated destructor stub
}
void OutputDevice::work(Task *task, double time) {
this->idle=false;
double worked=task->outputWorked(time, quantum);
activeTime = activeTime + worked;
OutFreeEvent* event= new OutFreeEvent(sim, task, task->getOutTime(), this);
sim->schedule(event);
}
int OutputDevice::getId() const {
return id;
}
void OutputDevice::setId(int id) {
OutputDevice::id = id;
}
bool OutputDevice::isIdle() const {
return idle;
}
void OutputDevice::setIdle(bool idle) {
OutputDevice::idle = idle;
}
double OutputDevice::getQuantum() const {
return quantum;
}
void OutputDevice::setQuantum(double quantum) {
OutputDevice::quantum = quantum;
}
double OutputDevice::getActiveTime() const {
return activeTime;
}
void OutputDevice::setActiveTime(double activeTime) {
OutputDevice::activeTime = activeTime;
}