-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPacient.hpp
131 lines (104 loc) · 3.74 KB
/
Pacient.hpp
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#ifndef PACIENT_HPP
#define PACIENT_HPP
#include <string>
#include <iostream>
using namespace std;
/** Representació d'un pacient.
*
* Consta de quatre atributs per emmagatzemar el nom (string),
* edat (enter), motiu de l'ingrés (string) i gravetat de
* l'estat de salut (int) d'un pacient.
*/
class Pacient {
private:
string nom;
int edat;
string motiu;
int gravetat; // int gravetat; // {alta=1, mitjana=2, baixa=3}
public:
//-------------
// Constructors
//-------------
/* Pre: cert */
/* Post: crea un pacient buit */
Pacient();
/* Pre: cert */
/* Post: crea un pacient de nom 'nom' */
Pacient(string nom);
/* Pre: cert */
/* Post: crea un pacient amb els valors de 'nom',
'edat', 'motiu' i 'gravetat' rebuts per paràmetre */
Pacient(string nom, int edat, string motiu, int gravetat);
/* Pre: cert */
/* Post: crea un pacient amb els mateixos paràmetres que el pacient 'p' */
Pacient(const Pacient &p);
// Destructor
// Post: esborra automaticament els objectes locals en sortir d'un ambit de visibilitat
~Pacient();
//-------------
// Modificadors
//-------------
/* Pre: cert */
/* Post: el valor de gravetat del pacient paràmetre
implícit passa a ser el valor de 'gravetat' */
void actualitzaEstat(int gravetat);
/* Pre: cert */
/* Post: retorna un pacient amb els mateixos paràmetres que el pacient 'p' */
Pacient& operator=(const Pacient &p);
//-----------
// Consultors
//-----------
/* Pre: cert */
/* Post: retorna el nom del pacient paràmetre implicit */
string getNom() const;
/* Pre: cert */
/* Post: retorna l'edat del pacient paràmetre implicit */
int getEdat() const;
/* Pre: cert */
/* Post: retorna el motiu de l'ingrés del pacient paràmetre
implicit */
string getMotiu() const;
/* Pre: cert */
/* Post: retorna la gravetat de l'estat del pacient paràmetre
implicit */
int getGravetat() const;
/* Pre: cert */
/* Post: retorna un booleà que indica si l'estat de gravetat
del pacient paràmetre implícit i el del pacient 'p' és
inferior (true) o no ho és (false) */
bool compare(const Pacient &p) const;
/* Pre: cert */
/* Post: retorna un booleà que indica si el pacient paràmetre
implícit i el pacient 'p' rebut són idèntics (true)
o no ho són (false)*/
bool mateixesDades(const Pacient &p) const;
/* Pre: cert */
/* Post: retorna un booleà que indica si el pacient paràmetre
implícit i el pacient 'p' rebut són idèntics (true)
o no ho són (false), només tenint en compte els noms */
bool operator==(Pacient p) const;
/* Pre: cert */
/* Post: retorna un booleà que indica si el pacient paràmetre
implícit és inferior al pacient 'p' rebut (true) o
no ho és (false), en base a l'ordenació alfabètica dels noms d'aquests */
bool operator<(Pacient p) const;
/* Pre: cert */
/* Post: retorna un booleà que indica si el pacient paràmetre
implícit és superior al pacient 'p' rebut (true) o
no ho és (false), en base a l'ordenació alfabètica dels noms d'aquests */
bool operator>(Pacient p) const;
//-----------
// L/E
//-----------
/* Pre: estan preparats al canal estàndard d'entrada quatre valors
en aquest ordre - string, enter, string i enter */
/* Post: el pacient 'p' passa a tenir els valors llegits del canal
estàndard d'entrada com a nom, edat, motiu i gravetat,
respectivament */
friend istream& operator>>(istream &is, Pacient &p);
/* Pre: cert */
/* Post: s'han escrit els atributs nom, edat, motiu i gravetat del
pacient 'p' al canal estàndard de sortida */
friend ostream& operator<<(ostream &os, const Pacient &p);
};
#endif