##// END OF EJS Templates
Some refac for new PySide2 bindings...
Some refac for new PySide2 bindings - made DataSourceItem iterable - added some tree print function for debug - fixed minor bug on DataSourceContorller which prevented from adding products in more than one call per provider - improved IDataProvider for future refac Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>

File last commit:

r92:9ff5f48e3d71
r92:9ff5f48e3d71
Show More
IDataProvider.h
60 lines | 1.6 KiB | text/x-c | CLexer
#ifndef SCIQLOP_IDATAPROVIDER_H
#define SCIQLOP_IDATAPROVIDER_H
#include "CoreGlobal.h"
#include <Common/MetaTypes.h>
#include <Common/deprecate.h>
#include <Data/DateTimeRange.h>
#include <QObject>
#include <QUuid>
#include <TimeSeries.h>
#include <functional>
#include <memory>
class DataProviderParameters;
class IDataSeries;
DEPRECATE(class QNetworkReply; class QNetworkRequest;)
/**
* @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.) Since
* its client mihgt use it from different threads it has to be either stateless
* and/or thread safe
*
* @sa IDataSeries
*/
class SCIQLOP_CORE_EXPORT IDataProvider : public QObject
{
Q_OBJECT
QUuid _id=QUuid::createUuid();
public:
virtual ~IDataProvider() noexcept = default;
// virtual std::shared_ptr<IDataProvider> clone() const = 0;
// Synchronous call -> asyncGetData may be written for asynchronous get
virtual TimeSeries::ITimeSerie*
getData(const DataProviderParameters& parameters) = 0;
QUuid id() const { return _id; }
QString name()
{
return QString("%1-%2").arg(this->metaObject()->className()).arg(id().toString());
}
signals:
void progress(QUuid requestID, double progress);
};
// Required for using shared_ptr in signals/slots
SCIQLOP_REGISTER_META_TYPE(IDATAPROVIDER_PTR_REGISTRY,
std::shared_ptr<IDataProvider>)
SCIQLOP_REGISTER_META_TYPE(IDATAPROVIDER_FUNCTION_REGISTRY,
std::function<void(QNetworkReply*, QUuid)>)
#endif // SCIQLOP_IDATAPROVIDER_H