IDataProvider.h
51 lines
| 1.5 KiB
| text/x-c
|
CLexer
r0 | #ifndef SCIQLOP_IDATAPROVIDER_H | |||
#define SCIQLOP_IDATAPROVIDER_H | ||||
#include "CoreGlobal.h" | ||||
#include <Common/MetaTypes.h> | ||||
r60 | #include <Common/deprecate.h> | |||
r0 | #include <Data/DateTimeRange.h> | |||
r60 | #include <QObject> | |||
#include <QUuid> | ||||
r67 | #include <TimeSeries.h> | |||
r0 | #include <functional> | |||
r60 | #include <memory> | |||
r0 | ||||
class DataProviderParameters; | ||||
class IDataSeries; | ||||
r60 | DEPRECATE(class QNetworkReply; class QNetworkRequest;) | |||
r0 | ||||
/** | ||||
* @brief The IDataProvider interface aims to declare a data provider. | ||||
* | ||||
r60 | * A data provider is an entity that generates data and returns it according to | |||
* various parameters (time interval, product to retrieve the data, etc.) Since | ||||
* its client mihgt use it from different threads it has to be either stateless | ||||
* and/or thread safe | ||||
r0 | * | |||
* @sa IDataSeries | ||||
*/ | ||||
r60 | class SCIQLOP_CORE_EXPORT IDataProvider : public QObject | |||
{ | ||||
Q_OBJECT | ||||
r0 | public: | |||
r60 | virtual ~IDataProvider() noexcept = default; | |||
virtual std::shared_ptr<IDataProvider> clone() const = 0; | ||||
r0 | ||||
r60 | // Synchronous call -> asyncGetData may be written for asynchronous get | |||
r67 | virtual TimeSeries::ITimeSerie* | |||
getData(const DataProviderParameters& parameters) = 0; | ||||
r0 | ||||
signals: | ||||
r60 | void progress(QUuid requestID, double progress); | |||
r0 | }; | |||
// Required for using shared_ptr in signals/slots | ||||
r60 | SCIQLOP_REGISTER_META_TYPE(IDATAPROVIDER_PTR_REGISTRY, | |||
std::shared_ptr<IDataProvider>) | ||||
r0 | SCIQLOP_REGISTER_META_TYPE(IDATAPROVIDER_FUNCTION_REGISTRY, | |||
r60 | std::function<void(QNetworkReply*, QUuid)>) | |||
r0 | ||||
#endif // SCIQLOP_IDATAPROVIDER_H | ||||