-
Notifications
You must be signed in to change notification settings - Fork 0
/
athlete.h
81 lines (58 loc) · 1.65 KB
/
athlete.h
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
#ifndef ATHLETE_INCL_GUARD
#define ATHLETE_INCL_GUARD
#include <iostream>
#include <vector>
#include <set>
#include <string>
#define N 4
class Athlete {
private:
int id;
std::string firstName;
std::string surName;
float rankPoints;
// This could be better as a std::multiset
//vector<float> racePoints;
std::multiset<float> racePoints;
public:
Athlete( std::string inFirstName, std::string inSurName );
~Athlete() {};
void clear();
void modifyName( std::string inFirstName, std::string inSurName );
// Get the name with semicolons removed for searching in files
std::string getSearchName() {
return surName + firstName;
}
// Get the surName
std::string getSurName() {
return surName;
}
// Get the firstName
std::string getFirstName() {
return firstName;
}
void print() const;
void printToDbFile( std::ofstream &dbFile );
float setRankPoints( float inPoints ) {
rankPoints = inPoints;
}
float getRankPoints() const {
return rankPoints;
}
void scaleAllPoints( float scale );
float getPoints( int i ) const;
void givePoints( float inPoints );
bool operator < ( const Athlete& ath) const {
return ( rankPoints > ath.getRankPoints() );
}
bool operator > ( const Athlete& ath) const {
return ( rankPoints < ath.getRankPoints() );
}
//FIXME for now we don't also copy the race points
// bool operator = ( const Athlete& ath ) const {
// firstName = ath.getFirstName();
// surName = ath.getSurName();
// rankPoints = ath.getRankPoints();
// }
};
#endif