IDataProvider.h
76 lines
| 2.3 KiB
| text/x-c
|
CLexer
Alexandre Leroux
|
r114 | #ifndef SCIQLOP_IDATAPROVIDER_H | ||
#define SCIQLOP_IDATAPROVIDER_H | ||||
Alexandre Leroux
|
r425 | #include "CoreGlobal.h" | ||
Alexandre Leroux
|
r114 | #include <memory> | ||
Alexandre Leroux
|
r157 | #include <QObject> | ||
Alexandre Leroux
|
r347 | #include <QUuid> | ||
Alexandre Leroux
|
r157 | |||
Alexandre Leroux
|
r285 | #include <Common/MetaTypes.h> | ||
r471 | #include <Data/SqpRange.h> | |||
r217 | ||||
r400 | #include <functional> | |||
Alexandre Leroux
|
r114 | class DataProviderParameters; | ||
class IDataSeries; | ||||
r357 | class QNetworkReply; | |||
class QNetworkRequest; | ||||
Alexandre Leroux
|
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 | ||||
*/ | ||||
Alexandre Leroux
|
r425 | class SCIQLOP_CORE_EXPORT IDataProvider : public QObject { | ||
r217 | ||||
Q_OBJECT | ||||
Alexandre Leroux
|
r114 | public: | ||
virtual ~IDataProvider() noexcept = default; | ||||
r357 | /** | |||
r510 | * @brief requestDataLoading provide datas for the data identified by acqIdentifier and | |||
* parameters | ||||
r357 | */ | |||
r510 | virtual void requestDataLoading(QUuid acqIdentifier, const DataProviderParameters ¶meters) | |||
= 0; | ||||
r217 | ||||
r388 | /** | |||
r510 | * @brief requestDataAborting stop data loading of the data identified by acqIdentifier | |||
r388 | */ | |||
r510 | virtual void requestDataAborting(QUuid acqIdentifier) = 0; | |||
r388 | ||||
r217 | signals: | |||
r357 | /** | |||
* @brief dataProvided send dataSeries under dateTime and that corresponds of the data | ||||
r510 | * identified by acqIdentifier | |||
r357 | */ | |||
r510 | void dataProvided(QUuid acqIdentifier, std::shared_ptr<IDataSeries> dateSeriesAcquired, | |||
const SqpRange &dataRangeAcquired); | ||||
r357 | ||||
r391 | /** | |||
* @brief dataProvided send dataSeries under dateTime and that corresponds of the data | ||||
* identified by identifier | ||||
*/ | ||||
r510 | void dataProvidedProgress(QUuid acqIdentifier, double progress); | |||
r391 | ||||
r357 | ||||
/** | ||||
r510 | * @brief requestConstructed send a request for the data identified by acqIdentifier | |||
r357 | * @callback is the methode call by the reply of the request when it is finished. | |||
*/ | ||||
r510 | void requestConstructed(const QNetworkRequest &request, QUuid acqIdentifier, | |||
r357 | std::function<void(QNetworkReply *, QUuid)> callback); | |||
r217 | }; | |||
Alexandre Leroux
|
r285 | |||
Alexandre Leroux
|
r157 | // Required for using shared_ptr in signals/slots | ||
Alexandre Leroux
|
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)>) | ||||
Alexandre Leroux
|
r157 | |||
Alexandre Leroux
|
r114 | #endif // SCIQLOP_IDATAPROVIDER_H | ||