-
Notifications
You must be signed in to change notification settings - Fork 0
/
measure.h
53 lines (42 loc) · 1.43 KB
/
measure.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
#ifndef MEASURE_H_
#define MEASURE_H_
/*
+---------------------------------------+
| BETH YW? WELSH GOVERNMENT DATA PARSER |
+---------------------------------------+
AUTHOR: 956213
This file contains the decalaration of the Measure class.
TODO: Read the block comments with TODO in measure.cpp to know which
functions and member variables you need to declare in this class.
*/
#include <string>
#include <map>
/*
The Measure class contains a measure code, label, and a container for readings
from across a number of years.
TODO: Based on your implementation, there may be additional constructors
or functions you implement here, and perhaps additional operators you may wish
to overload.
*/
class Measure {
public:
Measure(std::string code, std::string label);
std::string& getCodename();
std::string& getLabel();
void setLabel(std::string label);
double getValue(unsigned int key);
void setValue(unsigned int key, double value);
unsigned int size();
double getDifference();
double getDifferenceAsPercentage();
double getAverage();
std::map<unsigned int, double> getValues();
template<typename T> std::string alignValue(T t, const int& width);
friend bool operator==(const Measure& lhs, const Measure& rhs);
friend std::ostream &operator<<(std::ostream &os, Measure& measure);
private:
std::string label;
std::string codename;
std::map<unsigned int, double> values;
};
#endif // MEASURE_H_