-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.h
70 lines (46 loc) · 1.24 KB
/
app.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
#pragma once
#ifndef APP_H
# define APP_H
#include <QCoreApplication>
#include <memory>
namespace El {
class Args;
class Consumption;
class Prices;
class App : public QCoreApplication {
Q_OBJECT
public:
/// Wait for the `flag` to become `true`
/// @param[in] flag The flag
/// @param[in] ms Timeout in milliseconds
/// @return The value of the `flag`
static auto wait_for(bool const &flag, int ms) -> bool;
/// Ctor
App(Args const &args, int &argc, char **argv);
/// Dtor
~App() override;
/// Arguments for the application
inline auto args() const noexcept -> auto const & { return _args; }
private slots:
void process();
private: // NOLINT
/// Arguments for the application
Args const &_args;
/// Consumption records
std::unique_ptr<Consumption> _consumption;
/// Nord Pool prices
std::unique_ptr<Prices> _prices;
/// Total day consumption kWh
double _day_kwh = 0.0;
/// Total night consumption kWh
double _night_kwh = 0.0;
/// Total day cost EUR
double _day_eur = 0.0;
/// Total night cost EUR
double _night_eur = 0.0;
auto calc() -> bool;
auto calc_summary() -> bool;
auto show_summary() -> bool;
};
} // namespace El
#endif