IDataProvider.h
81 lines
| 2.4 KiB
| text/x-c
|
CLexer
Alexandre Leroux
|
r122 | #ifndef SCIQLOP_IDATAPROVIDER_H | ||
#define SCIQLOP_IDATAPROVIDER_H | ||||
Alexandre Leroux
|
r461 | #include "CoreGlobal.h" | ||
Alexandre Leroux
|
r122 | #include <memory> | ||
Alexandre Leroux
|
r169 | #include <QObject> | ||
Alexandre Leroux
|
r376 | #include <QUuid> | ||
Alexandre Leroux
|
r169 | |||
Alexandre Leroux
|
r308 | #include <Common/MetaTypes.h> | ||
r512 | #include <Data/SqpRange.h> | |||
r233 | ||||
r434 | #include <functional> | |||
Alexandre Leroux
|
r122 | class DataProviderParameters; | ||
class IDataSeries; | ||||
r387 | class QNetworkReply; | |||
class QNetworkRequest; | ||||
Alexandre Leroux
|
r122 | |||
/** | ||||
* @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
|
r461 | class SCIQLOP_CORE_EXPORT IDataProvider : public QObject { | ||
r233 | ||||
Q_OBJECT | ||||
Alexandre Leroux
|
r122 | public: | ||
virtual ~IDataProvider() noexcept = default; | ||||
Alexandre Leroux
|
r712 | virtual std::shared_ptr<IDataProvider> clone() const = 0; | ||
Alexandre Leroux
|
r122 | |||
r387 | /** | |||
r539 | * @brief requestDataLoading provide datas for the data identified by acqIdentifier and | |||
* parameters | ||||
r387 | */ | |||
r539 | virtual void requestDataLoading(QUuid acqIdentifier, const DataProviderParameters ¶meters) | |||
= 0; | ||||
r233 | ||||
r422 | /** | |||
r539 | * @brief requestDataAborting stop data loading of the data identified by acqIdentifier | |||
r422 | */ | |||
r539 | virtual void requestDataAborting(QUuid acqIdentifier) = 0; | |||
r422 | ||||
r233 | signals: | |||
r387 | /** | |||
* @brief dataProvided send dataSeries under dateTime and that corresponds of the data | ||||
r539 | * identified by acqIdentifier | |||
r387 | */ | |||
r539 | void dataProvided(QUuid acqIdentifier, std::shared_ptr<IDataSeries> dateSeriesAcquired, | |||
const SqpRange &dataRangeAcquired); | ||||
r387 | ||||
r425 | /** | |||
r761 | * @brief dataProvidedProgress notify the progression of the data identifier by acqIdentifier | |||
*/ | ||||
r539 | void dataProvidedProgress(QUuid acqIdentifier, double progress); | |||
r425 | ||||
r761 | /** | |||
* @brief dataProvidedFailed notify that data acquisition has failed | ||||
*/ | ||||
void dataProvidedFailed(QUuid acqIdentifier); | ||||
r387 | ||||
/** | ||||
r539 | * @brief requestConstructed send a request for the data identified by acqIdentifier | |||
r387 | * @callback is the methode call by the reply of the request when it is finished. | |||
*/ | ||||
r751 | void requestConstructed(std::shared_ptr<QNetworkRequest> request, QUuid acqIdentifier, | |||
r387 | std::function<void(QNetworkReply *, QUuid)> callback); | |||
r233 | }; | |||
Alexandre Leroux
|
r308 | |||
Alexandre Leroux
|
r169 | // Required for using shared_ptr in signals/slots | ||
Alexandre Leroux
|
r308 | SCIQLOP_REGISTER_META_TYPE(IDATAPROVIDER_PTR_REGISTRY, std::shared_ptr<IDataProvider>) | ||
r387 | SCIQLOP_REGISTER_META_TYPE(IDATAPROVIDER_FUNCTION_REGISTRY, | |||
std::function<void(QNetworkReply *, QUuid)>) | ||||
Alexandre Leroux
|
r169 | |||
Alexandre Leroux
|
r122 | #endif // SCIQLOP_IDATAPROVIDER_H | ||