IDataProvider.h
60 lines
| 1.8 KiB
| text/x-c
|
CLexer
|
r114 | #ifndef SCIQLOP_IDATAPROVIDER_H | ||
#define SCIQLOP_IDATAPROVIDER_H | ||||
#include <memory> | ||||
|
r157 | #include <QObject> | ||
|
r347 | #include <QUuid> | ||
|
r157 | |||
|
r285 | #include <Common/MetaTypes.h> | ||
r217 | #include <Data/SqpDateTime.h> | |||
|
r114 | class DataProviderParameters; | ||
class IDataSeries; | ||||
r357 | class QNetworkReply; | |||
class QNetworkRequest; | ||||
|
r114 | |||
/** | ||||
* @brief The IDataProvider interface aims to declare a data provider. | ||||
* | ||||
* A data provider is an entity that generates data and returns it according to various parameters | ||||
* (time interval, product to retrieve the data, etc.) | ||||
* | ||||
* @sa IDataSeries | ||||
*/ | ||||
r217 | class IDataProvider : public QObject { | |||
Q_OBJECT | ||||
|
r114 | public: | ||
virtual ~IDataProvider() noexcept = default; | ||||
r357 | /** | |||
* @brief requestDataLoading provide datas for the data identified by identifier for all | ||||
* SqpDateTime of dateTimeList | ||||
*/ | ||||
virtual void requestDataLoading(QUuid identifier, const QVector<SqpDateTime> &dateTimeList) = 0; | ||||
r217 | ||||
signals: | ||||
r357 | /** | |||
* @brief dataProvided send dataSeries under dateTime and that corresponds of the data | ||||
* identified by identifier | ||||
*/ | ||||
void dataProvided(QUuid identifier, std::shared_ptr<IDataSeries> dateSerie, | ||||
|
r347 | const SqpDateTime &dateTime); | ||
r357 | ||||
/** | ||||
* @brief requestConstructed send a request for the data identified by identifier | ||||
* @callback is the methode call by the reply of the request when it is finished. | ||||
*/ | ||||
void requestConstructed(const QNetworkRequest &request, QUuid identifier, | ||||
std::function<void(QNetworkReply *, QUuid)> callback); | ||||
r217 | }; | |||
|
r285 | |||
|
r157 | // Required for using shared_ptr in signals/slots | ||
|
r285 | SCIQLOP_REGISTER_META_TYPE(IDATAPROVIDER_PTR_REGISTRY, std::shared_ptr<IDataProvider>) | ||
r357 | SCIQLOP_REGISTER_META_TYPE(IDATAPROVIDER_FUNCTION_REGISTRY, | |||
std::function<void(QNetworkReply *, QUuid)>) | ||||
|
r157 | |||
|
r114 | #endif // SCIQLOP_IDATAPROVIDER_H | ||