-
Notifications
You must be signed in to change notification settings - Fork 0
/
Mapping.h
39 lines (28 loc) · 810 Bytes
/
Mapping.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
#ifndef MAPPING_H
#define MAPPING_H
#include <string>
#include <vector>
#include "common.h"
#include "Result.h"
#include "Temperature.h"
struct MappingPoint {
Temperature temperature;
int seconds;
};
class Mapping {
public:
static Result<Mapping> parseFromString(std::string string);
private:
constexpr static Temperature MIN_TEMPERATURE = Temperature::forDegreesC(0);
constexpr static Temperature MAX_TEMPERATURE = Temperature::forDegreesC(50);
constexpr static int MIN_DURATION = 30;
constexpr static int MAX_DURATION = 15 * SECONDS_PER_MINUTE;
public:
Mapping() {}
int mapTemperatureToSeconds(Temperature const &temperature) const;
std::string toString() const;
private:
std::vector<MappingPoint> points;
Mapping(std::vector<MappingPoint> const &points) : points(points) {}
};
#endif