-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprices.h
58 lines (40 loc) · 1.13 KB
/
prices.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
#pragma once
#ifndef EL_PRICES_H_INCLUDED
# define EL_PRICES_H_INCLUDED
#include "common.h"
#include <QtGlobal>
#include <memory>
#include <optional>
QT_FORWARD_DECLARE_CLASS(QDateTime)
QT_FORWARD_DECLARE_CLASS(QString)
namespace El {
class App;
class Cache;
/// Hourly Nord Pool prices
class Prices {
public:
/// Ctor
/// @param[in] app Application instance
Prices(App const &app);
/// Dtor
~Prices();
/// Loads hourly prices for the given time period
/// @param[in] region Price region
/// @param[in] start Start time
/// @param[in] end End time
/// @return true when succeeded, otherwise false
auto load(QString const ®ion, QDateTime const &start, QDateTime const &end) -> bool;
/// Get the price in Euros for one kWh for the given time
/// @param[in] time The date/time
/// @return The price or an empty value
auto get_price(QDateTime const &time) const -> std::optional<double>;
private:
/// Application instance
App const &_app;
/// Prices cache
std::unique_ptr<Cache> _cache;
/// Price blocks
PriceBlocks _prices;
};
} // namespace El
#endif