-
Notifications
You must be signed in to change notification settings - Fork 0
/
Process.cpp
68 lines (58 loc) · 1.54 KB
/
Process.cpp
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
/**
* Author: Shania Dhani
* Date Modified May 12, 2020
*
* Process represents a basic process in the simulation and contains a PID,
* the process's memory size, and the process type (Real Time or Common, in this case).
*/
#include "Process.hpp"
//default constructor
Process::Process() {}
Process::Process(const Process &p)
{
process_type_ = p.getProcessType();
memory_size_ = p.getMemorySize();
pid_ = p.getPID();
}
//@param process_type, Type of Process
//@param memory_size, Memory Size of Process
//@param pid, PID of Process
//constructor, takes in Process info to create Process object
Process::Process(const std::string &process_type, const long long int &memory_size, const long long int &pid)
{
process_type_ = process_type; /* Common Process or RT-process */
memory_size_ = memory_size;
pid_ = pid; /* Don't reassign PID's */
}
// sets process_type
//@param process_type, Type of Process
void Process::setProcessType(const std::string &process_type)
{
process_type_ = process_type;
}
// sets memory_size
//@param memory_size, Memory Size of Process
void Process::setMemorySize(const long long int &memory_size)
{
memory_size_ = memory_size;
}
// sets pid EXPLORE AUTO-INCREMENT/COUNT OF PROCESSES "BAG"
void Process::setPID(const long long int &pid)
{
pid_ = pid;
}
// @return process type
std::string Process::getProcessType() const
{
return process_type_;
}
// @return memory size
long long int Process::getMemorySize() const
{
return memory_size_;
}
// @return pid
long long int Process::getPID() const
{
return pid_;
}