-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
53 lines (43 loc) · 1.14 KB
/
main.cpp
File metadata and controls
53 lines (43 loc) · 1.14 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
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iterator>
#include "FileReader/FileReader.hpp"
#include "Queue/Queue.hpp"
#include "Queue/QueueUtils.hpp"
#include "Paging/FIFO.hpp"
#include "Paging/LRU.hpp"
#include "Paging/Optimal.hpp"
#include "Tests/Test.hpp"
using namespace std;
const string FILE_ADDRESS = "input.txt";
vector<int> readDataFromFile()
{
return FileReader::ReadFile(FILE_ADDRESS);
}
void runProgram()
{
vector<int> allInputs = readDataFromFile();
Queue<int>* queue = QueueUtils::from_std_vector(allInputs);
int boardQuantity = queue->Dequeue();
FIFO* fifo = new FIFO(boardQuantity);
Optimal* optimal = new Optimal(boardQuantity);
LRU* lru = new LRU(boardQuantity);
fifo->ProcessInputs(queue->Copy());
optimal->ProcessInputs(queue->Copy());
lru->ProcessInputs(queue->Copy());
cout << "FIFO " << fifo->GetMissPageQuant() << endl;
cout << "OTM " << optimal->GetMissPageQuant() << endl;
cout << "LRU " << lru->GetMissPageQuant() << endl;
}
void runTests()
{
Test::RunTests();
}
int main()
{
//runTests();
runProgram();
return 0;
}