-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPatient.cpp
More file actions
48 lines (42 loc) · 1.01 KB
/
Copy pathPatient.cpp
File metadata and controls
48 lines (42 loc) · 1.01 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
//
// Created by Nichlos Ho on 10/30/20.
//
#include "Patient.h"
#include <sstream>
#include <utility>
using namespace std;
int Patient::counter;
Patient::Patient(std::string n, Patient::priority PC) {
name = std::move(n);
priorityCode = PC;
counter++;
arrivalOrder = counter;
}
Patient Patient::compareTo(Patient &a, Patient &b) {
if (a.priorityCode - b.priorityCode < 0)
return a;
if (a.priorityCode - b.priorityCode == 0){
if (a.arrivalOrder - b.arrivalOrder < 0){
return a;
}
return b;
}
return b;
}
std::string Patient::toString() {
ostringstream ss;
ss << name << " { pri=";
if (priorityCode == IMMEDIATE){
ss << "IMMEDIATE";
} else if (priorityCode == EMERGENCY){
ss << "EMERGENCY";
}else if (priorityCode == URGENT){
ss << "URGENT";
}else
ss << "MINIMAL";
ss << ", arrive=" << arrivalOrder << " }" << endl;
return ss.str();
}
std::string Patient::getName() {
return name;
}