-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrdq.cpp
More file actions
38 lines (32 loc) · 906 Bytes
/
Copy pathrdq.cpp
File metadata and controls
38 lines (32 loc) · 906 Bytes
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
#include "rdq.h"
#include "task.h"
#include <vector>
#include <list>
#include <iostream>
using namespace std;
vector<task *> rdq::getTaskq(){
vector<task *> ret;
for(list<task *>::iterator it = taskq.begin(); it != taskq.end(); it++){
ret.push_back(*it);
}
return ret;
}
void rdq::push(task * newtask){
taskq.push_back(newtask);
}
void rdq::pop(){
taskq.pop_front();
}
int rdq::getSize(){ return taskq.size();}
bool rdq::isEmpty() {return taskq.empty();}
task * rdq::getfront(){ return taskq.front(); }
void rdq::show(){
list<task *> taskq_tmp = taskq;
task * tmp;
cout << endl << "Showing RDQ Info" << endl;
while(!taskq_tmp.empty()){
tmp = taskq_tmp.front();
taskq_tmp.pop_front();
cout << "ID:" << tmp->id << " T_arr:" << tmp->t_arrival << " T_ddl:" << tmp->t_deadline << " Cycles:" << tmp->cycles << " Missed ddl?:" << tmp->missed << " Energy:" << tmp->e_consumed << endl;
}
}