-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnordpool.h
55 lines (37 loc) · 1.16 KB
/
nordpool.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
#pragma once
#ifndef EL_NORDPOOL_H_INCLUDED
# define EL_NORDPOOL_H_INCLUDED
#include "common.h"
#include <QObject>
#include <QVector>
QT_FORWARD_DECLARE_CLASS(QNetworkAccessManager)
QT_FORWARD_DECLARE_CLASS(QNetworkReply)
namespace El {
class App;
/// Class that queries Nord Pool prices over the network
class NordPool : public QObject {
Q_OBJECT
public:
/// Ctor
/// @param[in] app The application instance
/// @param[in] parent Optional parent
NordPool(App const &app, QObject *parent = nullptr);
/// Dtor
~NordPool() override;
/// Request NordPool prices
/// @param[in] region Price region
/// @param[in] start_h Start time (hours since the EPOCH)
/// @param[in] end_h End time (hours since the EPOCH)
/// @return Price blocks with NordPool prices
/// @throws El::Exception on errors
auto get_prices(QString const ®ion, int start_h, int end_h) -> PriceBlocks;
private:
/// Application instance
App const &_app;
/// Network access manager
QNetworkAccessManager *_manager = nullptr;
/// Flag indicating that network request is finished
bool _done = false;
};
} // namespace El
#endif