@@ -1,40 +1,60 | |||||
1 | #ifndef SCIQLOP_IDATAPROVIDER_H |
|
1 | #ifndef SCIQLOP_IDATAPROVIDER_H | |
2 | #define SCIQLOP_IDATAPROVIDER_H |
|
2 | #define SCIQLOP_IDATAPROVIDER_H | |
3 |
|
3 | |||
4 | #include <memory> |
|
4 | #include <memory> | |
5 |
|
5 | |||
6 | #include <QObject> |
|
6 | #include <QObject> | |
7 | #include <QUuid> |
|
7 | #include <QUuid> | |
8 |
|
8 | |||
9 | #include <Common/MetaTypes.h> |
|
9 | #include <Common/MetaTypes.h> | |
10 |
|
10 | |||
11 | #include <Data/SqpDateTime.h> |
|
11 | #include <Data/SqpDateTime.h> | |
12 |
|
12 | |||
13 | class DataProviderParameters; |
|
13 | class DataProviderParameters; | |
14 | class IDataSeries; |
|
14 | class IDataSeries; | |
|
15 | class QNetworkReply; | |||
|
16 | class QNetworkRequest; | |||
15 |
|
17 | |||
16 | /** |
|
18 | /** | |
17 | * @brief The IDataProvider interface aims to declare a data provider. |
|
19 | * @brief The IDataProvider interface aims to declare a data provider. | |
18 | * |
|
20 | * | |
19 | * A data provider is an entity that generates data and returns it according to various parameters |
|
21 | * A data provider is an entity that generates data and returns it according to various parameters | |
20 | * (time interval, product to retrieve the data, etc.) |
|
22 | * (time interval, product to retrieve the data, etc.) | |
21 | * |
|
23 | * | |
22 | * @sa IDataSeries |
|
24 | * @sa IDataSeries | |
23 | */ |
|
25 | */ | |
24 | class IDataProvider : public QObject { |
|
26 | class IDataProvider : public QObject { | |
25 |
|
27 | |||
26 | Q_OBJECT |
|
28 | Q_OBJECT | |
27 | public: |
|
29 | public: | |
28 | virtual ~IDataProvider() noexcept = default; |
|
30 | virtual ~IDataProvider() noexcept = default; | |
29 |
|
31 | |||
30 | virtual void requestDataLoading(QUuid token, const QVector<SqpDateTime> &dateTimeList) = 0; |
|
32 | /** | |
|
33 | * @brief requestDataLoading provide datas for the data identified by identifier for all | |||
|
34 | * SqpDateTime of dateTimeList | |||
|
35 | */ | |||
|
36 | virtual void requestDataLoading(QUuid identifier, const QVector<SqpDateTime> &dateTimeList) = 0; | |||
31 |
|
37 | |||
32 | signals: |
|
38 | signals: | |
33 | void dataProvided(QUuid token, std::shared_ptr<IDataSeries> dateSerie, |
|
39 | /** | |
|
40 | * @brief dataProvided send dataSeries under dateTime and that corresponds of the data | |||
|
41 | * identified by identifier | |||
|
42 | */ | |||
|
43 | void dataProvided(QUuid identifier, std::shared_ptr<IDataSeries> dateSerie, | |||
34 | const SqpDateTime &dateTime); |
|
44 | const SqpDateTime &dateTime); | |
|
45 | ||||
|
46 | ||||
|
47 | /** | |||
|
48 | * @brief requestConstructed send a request for the data identified by identifier | |||
|
49 | * @callback is the methode call by the reply of the request when it is finished. | |||
|
50 | */ | |||
|
51 | void requestConstructed(const QNetworkRequest &request, QUuid identifier, | |||
|
52 | std::function<void(QNetworkReply *, QUuid)> callback); | |||
35 | }; |
|
53 | }; | |
36 |
|
54 | |||
37 | // Required for using shared_ptr in signals/slots |
|
55 | // Required for using shared_ptr in signals/slots | |
38 | SCIQLOP_REGISTER_META_TYPE(IDATAPROVIDER_PTR_REGISTRY, std::shared_ptr<IDataProvider>) |
|
56 | SCIQLOP_REGISTER_META_TYPE(IDATAPROVIDER_PTR_REGISTRY, std::shared_ptr<IDataProvider>) | |
|
57 | SCIQLOP_REGISTER_META_TYPE(IDATAPROVIDER_FUNCTION_REGISTRY, | |||
|
58 | std::function<void(QNetworkReply *, QUuid)>) | |||
39 |
|
59 | |||
40 | #endif // SCIQLOP_IDATAPROVIDER_H |
|
60 | #endif // SCIQLOP_IDATAPROVIDER_H |
General Comments 0
You need to be logged in to leave comments.
Login now