##// END OF EJS Templates
Add functionnal include missing
perrinel -
r434:fc95d1db826f
parent child
Show More
@@ -1,70 +1,72
1 #ifndef SCIQLOP_IDATAPROVIDER_H
1 #ifndef SCIQLOP_IDATAPROVIDER_H
2 #define SCIQLOP_IDATAPROVIDER_H
2 #define SCIQLOP_IDATAPROVIDER_H
3
3
4 #include <memory>
4 #include <memory>
5
5
6 #include <QObject>
6 #include <QObject>
7 #include <QUuid>
7 #include <QUuid>
8
8
9 #include <Common/MetaTypes.h>
9 #include <Common/MetaTypes.h>
10
10
11 #include <Data/SqpDateTime.h>
11 #include <Data/SqpDateTime.h>
12
12
13 #include <functional>
14
13 class DataProviderParameters;
15 class DataProviderParameters;
14 class IDataSeries;
16 class IDataSeries;
15 class QNetworkReply;
17 class QNetworkReply;
16 class QNetworkRequest;
18 class QNetworkRequest;
17
19
18 /**
20 /**
19 * @brief The IDataProvider interface aims to declare a data provider.
21 * @brief The IDataProvider interface aims to declare a data provider.
20 *
22 *
21 * A data provider is an entity that generates data and returns it according to various parameters
23 * A data provider is an entity that generates data and returns it according to various parameters
22 * (time interval, product to retrieve the data, etc.)
24 * (time interval, product to retrieve the data, etc.)
23 *
25 *
24 * @sa IDataSeries
26 * @sa IDataSeries
25 */
27 */
26 class IDataProvider : public QObject {
28 class IDataProvider : public QObject {
27
29
28 Q_OBJECT
30 Q_OBJECT
29 public:
31 public:
30 virtual ~IDataProvider() noexcept = default;
32 virtual ~IDataProvider() noexcept = default;
31
33
32 /**
34 /**
33 * @brief requestDataLoading provide datas for the data identified by identifier and parameters
35 * @brief requestDataLoading provide datas for the data identified by identifier and parameters
34 */
36 */
35 virtual void requestDataLoading(QUuid identifier, const DataProviderParameters &parameters) = 0;
37 virtual void requestDataLoading(QUuid identifier, const DataProviderParameters &parameters) = 0;
36
38
37 /**
39 /**
38 * @brief requestDataAborting stop data loading of the data identified by identifier
40 * @brief requestDataAborting stop data loading of the data identified by identifier
39 */
41 */
40 virtual void requestDataAborting(QUuid identifier) = 0;
42 virtual void requestDataAborting(QUuid identifier) = 0;
41
43
42 signals:
44 signals:
43 /**
45 /**
44 * @brief dataProvided send dataSeries under dateTime and that corresponds of the data
46 * @brief dataProvided send dataSeries under dateTime and that corresponds of the data
45 * identified by identifier
47 * identified by identifier
46 */
48 */
47 void dataProvided(QUuid identifier, std::shared_ptr<IDataSeries> dateSerie,
49 void dataProvided(QUuid identifier, std::shared_ptr<IDataSeries> dateSerie,
48 const SqpDateTime &dateTime);
50 const SqpDateTime &dateTime);
49
51
50 /**
52 /**
51 * @brief dataProvided send dataSeries under dateTime and that corresponds of the data
53 * @brief dataProvided send dataSeries under dateTime and that corresponds of the data
52 * identified by identifier
54 * identified by identifier
53 */
55 */
54 void dataProvidedProgress(QUuid identifier, double progress);
56 void dataProvidedProgress(QUuid identifier, double progress);
55
57
56
58
57 /**
59 /**
58 * @brief requestConstructed send a request for the data identified by identifier
60 * @brief requestConstructed send a request for the data identified by identifier
59 * @callback is the methode call by the reply of the request when it is finished.
61 * @callback is the methode call by the reply of the request when it is finished.
60 */
62 */
61 void requestConstructed(const QNetworkRequest &request, QUuid identifier,
63 void requestConstructed(const QNetworkRequest &request, QUuid identifier,
62 std::function<void(QNetworkReply *, QUuid)> callback);
64 std::function<void(QNetworkReply *, QUuid)> callback);
63 };
65 };
64
66
65 // Required for using shared_ptr in signals/slots
67 // Required for using shared_ptr in signals/slots
66 SCIQLOP_REGISTER_META_TYPE(IDATAPROVIDER_PTR_REGISTRY, std::shared_ptr<IDataProvider>)
68 SCIQLOP_REGISTER_META_TYPE(IDATAPROVIDER_PTR_REGISTRY, std::shared_ptr<IDataProvider>)
67 SCIQLOP_REGISTER_META_TYPE(IDATAPROVIDER_FUNCTION_REGISTRY,
69 SCIQLOP_REGISTER_META_TYPE(IDATAPROVIDER_FUNCTION_REGISTRY,
68 std::function<void(QNetworkReply *, QUuid)>)
70 std::function<void(QNetworkReply *, QUuid)>)
69
71
70 #endif // SCIQLOP_IDATAPROVIDER_H
72 #endif // SCIQLOP_IDATAPROVIDER_H
@@ -1,48 +1,50
1 #ifndef SCIQLOP_DATASOURCEITEMACTION_H
1 #ifndef SCIQLOP_DATASOURCEITEMACTION_H
2 #define SCIQLOP_DATASOURCEITEMACTION_H
2 #define SCIQLOP_DATASOURCEITEMACTION_H
3
3
4 #include <Common/spimpl.h>
4 #include <Common/spimpl.h>
5
5
6 #include <QLoggingCategory>
6 #include <QLoggingCategory>
7 #include <QObject>
7 #include <QObject>
8
8
9 #include <functional>
10
9 Q_DECLARE_LOGGING_CATEGORY(LOG_DataSourceItemAction)
11 Q_DECLARE_LOGGING_CATEGORY(LOG_DataSourceItemAction)
10
12
11 class DataSourceItem;
13 class DataSourceItem;
12
14
13 /**
15 /**
14 * @brief The DataSourceItemAction class represents an action on a data source item.
16 * @brief The DataSourceItemAction class represents an action on a data source item.
15 *
17 *
16 * An action is a function that will be executed when the slot execute() is called.
18 * An action is a function that will be executed when the slot execute() is called.
17 */
19 */
18 class DataSourceItemAction : public QObject {
20 class DataSourceItemAction : public QObject {
19
21
20 Q_OBJECT
22 Q_OBJECT
21
23
22 public:
24 public:
23 /// Signature of the function associated to the action
25 /// Signature of the function associated to the action
24 using ExecuteFunction = std::function<void(DataSourceItem &dataSourceItem)>;
26 using ExecuteFunction = std::function<void(DataSourceItem &dataSourceItem)>;
25
27
26 /**
28 /**
27 * Ctor
29 * Ctor
28 * @param name the name of the action
30 * @param name the name of the action
29 * @param fun the function that will be called when the action is executed
31 * @param fun the function that will be called when the action is executed
30 * @sa execute()
32 * @sa execute()
31 */
33 */
32 explicit DataSourceItemAction(const QString &name, ExecuteFunction fun);
34 explicit DataSourceItemAction(const QString &name, ExecuteFunction fun);
33
35
34 QString name() const noexcept;
36 QString name() const noexcept;
35
37
36 /// Sets the data source item concerned by the action
38 /// Sets the data source item concerned by the action
37 void setDataSourceItem(DataSourceItem *dataSourceItem) noexcept;
39 void setDataSourceItem(DataSourceItem *dataSourceItem) noexcept;
38
40
39 public slots:
41 public slots:
40 /// Executes the action
42 /// Executes the action
41 void execute();
43 void execute();
42
44
43 private:
45 private:
44 class DataSourceItemActionPrivate;
46 class DataSourceItemActionPrivate;
45 spimpl::unique_impl_ptr<DataSourceItemActionPrivate> impl;
47 spimpl::unique_impl_ptr<DataSourceItemActionPrivate> impl;
46 };
48 };
47
49
48 #endif // SCIQLOP_DATASOURCEITEMACTION_H
50 #endif // SCIQLOP_DATASOURCEITEMACTION_H
General Comments 0
You need to be logged in to leave comments. Login now