-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProcess.cpp
More file actions
33 lines (27 loc) · 1.21 KB
/
Process.cpp
File metadata and controls
33 lines (27 loc) · 1.21 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
//
// Created by asus on 24.11.2018.
//
#include <fstream>
#include "Process.h"
Process::Process(int priority, int arTime, const string &procName, const string &codeFile, int processID) {
this->priority=priority;
this->arTime=arTime; //arrival time
this->procName=procName; //process name
this->codeFile=codeFile; //assigned code file's name
this->compTime=0; //completion time of the process
this->instrPtr=0; //points to the next instruction to be executed
this->processID=processID; //ID of the process (which is the line number in the file)
int turnAround=0;
int waitingTime=0;
ifstream codeInput(this->codeFile+".txt", ios::in); //creates the writer object, opens the output file
string trash; //trash string to arrange the pulling necessary information from file
int exTime; //execution time of the instruction
//reads the input (assigned code file), pushes the instructions to the instructions vector
while (codeInput.good()){
codeInput >> trash >> exTime;
this->instrVec.push_back(exTime);
if(trash=="exit") //exits if exit instruction comes
break;
}
codeInput.close();
}