-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTask.cpp
More file actions
115 lines (93 loc) · 2.31 KB
/
Task.cpp
File metadata and controls
115 lines (93 loc) · 2.31 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/************************************************************************
* Task.cpp
* Author: Stephen Thomson
* Date: 2/8/2024
* Description: This file contains the implementation of the Task class
*
* *********************************************************************/
#include <iostream>
#include <string>
#include "Task.h"
using namespace std;
Task::Task(string name, int startTime, int computationTime, int softDeadline, int hardDeadline, int period)
{
m_name = name;
m_startTime = startTime;
m_computationTime = computationTime;
m_hardDeadline = hardDeadline;
m_softDeadline = softDeadline;
m_period = period;
m_currPeriod = 1;
m_laxity = hardDeadline - startTime - computationTime;
}
Task& Task::operator=(const Task& task)
{
if (this == &task)
{
return *this;
}
m_name = task.m_name;
m_startTime = task.m_startTime;
m_computationTime = task.m_computationTime;
m_hardDeadline = task.m_hardDeadline;
m_softDeadline = task.m_softDeadline;
m_period = task.m_period;
m_currPeriod = task.m_currPeriod;
m_laxity = task.m_laxity;
return *this;
}
int Task::getStartTime(){
return m_startTime;
}
void Task::setStartTime(int startTime){
m_startTime = startTime;
}
int Task::getComputationTime(){
return m_computationTime;
}
void Task::setComputationTime(int computationTime){
m_computationTime = computationTime;
}
int Task::getHardDeadline(){
return m_hardDeadline;
}
void Task::setHardDeadline(int hardDeadline){
m_hardDeadline = hardDeadline;
}
int Task::getSoftDeadline(){
return m_softDeadline;
}
void Task::setSoftDeadline(int softDeadline){
m_softDeadline = softDeadline;
}
int Task::getPeriod(){
return m_period;
}
void Task::setPeriod(int period){
m_period = period;
}
void Task::printTask(){
std::cout << "* " << m_name << ", S: " << m_startTime << ", C: " << m_computationTime << ", HD: " << m_hardDeadline << ", SD: " << m_softDeadline << ", P: " << m_period << std::endl;
}
void Task::setName(string name){
m_name = name;
}
string Task::getName(){
return m_name;
}
void Task::setLaxity(int laxity)
{
m_laxity = laxity;
}
int Task::getLaxity()
{
return m_laxity;
}
void Task::incramentCurrPeriod()
{
m_currPeriod++;
}
int Task::getCurrPeriod()
{
return m_currPeriod;
}