@@ -1,25 +1,30 | |||||
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> | |||
|
7 | ||||
6 | class DataProviderParameters; |
|
8 | class DataProviderParameters; | |
7 | class IDataSeries; |
|
9 | class IDataSeries; | |
8 |
|
10 | |||
9 | /** |
|
11 | /** | |
10 | * @brief The IDataProvider interface aims to declare a data provider. |
|
12 | * @brief The IDataProvider interface aims to declare a data provider. | |
11 | * |
|
13 | * | |
12 | * A data provider is an entity that generates data and returns it according to various parameters |
|
14 | * A data provider is an entity that generates data and returns it according to various parameters | |
13 | * (time interval, product to retrieve the data, etc.) |
|
15 | * (time interval, product to retrieve the data, etc.) | |
14 | * |
|
16 | * | |
15 | * @sa IDataSeries |
|
17 | * @sa IDataSeries | |
16 | */ |
|
18 | */ | |
17 | class IDataProvider { |
|
19 | class IDataProvider { | |
18 | public: |
|
20 | public: | |
19 | virtual ~IDataProvider() noexcept = default; |
|
21 | virtual ~IDataProvider() noexcept = default; | |
20 |
|
22 | |||
21 | virtual std::unique_ptr<IDataSeries> |
|
23 | virtual std::unique_ptr<IDataSeries> | |
22 | retrieveData(const DataProviderParameters ¶meters) const = 0; |
|
24 | retrieveData(const DataProviderParameters ¶meters) const = 0; | |
23 | }; |
|
25 | }; | |
24 |
|
26 | |||
|
27 | // Required for using shared_ptr in signals/slots | |||
|
28 | Q_DECLARE_METATYPE(std::shared_ptr<IDataProvider>) | |||
|
29 | ||||
25 | #endif // SCIQLOP_IDATAPROVIDER_H |
|
30 | #endif // SCIQLOP_IDATAPROVIDER_H |
@@ -1,81 +1,90 | |||||
1 | #ifndef SCIQLOP_DATASOURCECONTROLLER_H |
|
1 | #ifndef SCIQLOP_DATASOURCECONTROLLER_H | |
2 | #define SCIQLOP_DATASOURCECONTROLLER_H |
|
2 | #define SCIQLOP_DATASOURCECONTROLLER_H | |
3 |
|
3 | |||
4 | #include <QLoggingCategory> |
|
4 | #include <QLoggingCategory> | |
5 | #include <QObject> |
|
5 | #include <QObject> | |
6 | #include <QUuid> |
|
6 | #include <QUuid> | |
7 |
|
7 | |||
8 | #include <Common/spimpl.h> |
|
8 | #include <Common/spimpl.h> | |
9 |
|
9 | |||
10 | Q_DECLARE_LOGGING_CATEGORY(LOG_DataSourceController) |
|
10 | Q_DECLARE_LOGGING_CATEGORY(LOG_DataSourceController) | |
11 |
|
11 | |||
12 | class DataSourceItem; |
|
12 | class DataSourceItem; | |
13 | class IDataProvider; |
|
13 | class IDataProvider; | |
14 |
|
14 | |||
15 | /** |
|
15 | /** | |
16 | * @brief The DataSourceController class aims to make the link between SciQlop and its plugins. This |
|
16 | * @brief The DataSourceController class aims to make the link between SciQlop and its plugins. This | |
17 | * is the intermediate class that SciQlop has to use in the way to connect a data source. Please |
|
17 | * is the intermediate class that SciQlop has to use in the way to connect a data source. Please | |
18 | * first use register method to initialize a plugin specified by its metadata name (JSON plugin |
|
18 | * first use register method to initialize a plugin specified by its metadata name (JSON plugin | |
19 | * source) then others specifics method will be able to access it. You can load a data source driver |
|
19 | * source) then others specifics method will be able to access it. You can load a data source driver | |
20 | * plugin then create a data source. |
|
20 | * plugin then create a data source. | |
21 | */ |
|
21 | */ | |
22 | class DataSourceController : public QObject { |
|
22 | class DataSourceController : public QObject { | |
23 | Q_OBJECT |
|
23 | Q_OBJECT | |
24 | public: |
|
24 | public: | |
25 | explicit DataSourceController(QObject *parent = 0); |
|
25 | explicit DataSourceController(QObject *parent = 0); | |
26 | virtual ~DataSourceController(); |
|
26 | virtual ~DataSourceController(); | |
27 |
|
27 | |||
28 | /** |
|
28 | /** | |
29 | * Registers a data source. The method delivers a unique id that can be used afterwards to |
|
29 | * Registers a data source. The method delivers a unique id that can be used afterwards to | |
30 | * access to the data source properties (structure, connection parameters, data provider, etc.) |
|
30 | * access to the data source properties (structure, connection parameters, data provider, etc.) | |
31 | * @param dataSourceName the name of the data source |
|
31 | * @param dataSourceName the name of the data source | |
32 | * @return the unique id with which the data source has been registered |
|
32 | * @return the unique id with which the data source has been registered | |
33 | */ |
|
33 | */ | |
34 | QUuid registerDataSource(const QString &dataSourceName) noexcept; |
|
34 | QUuid registerDataSource(const QString &dataSourceName) noexcept; | |
35 |
|
35 | |||
36 | /** |
|
36 | /** | |
37 | * Sets the structure of a data source. The controller takes ownership of the structure. |
|
37 | * Sets the structure of a data source. The controller takes ownership of the structure. | |
38 | * @param dataSourceUid the unique id with which the data source has been registered into the |
|
38 | * @param dataSourceUid the unique id with which the data source has been registered into the | |
39 | * controller. If it is invalid, the method has no effect. |
|
39 | * controller. If it is invalid, the method has no effect. | |
40 | * @param dataSourceItem the structure of the data source |
|
40 | * @param dataSourceItem the structure of the data source | |
41 | * @sa registerDataSource() |
|
41 | * @sa registerDataSource() | |
42 | */ |
|
42 | */ | |
43 | void setDataSourceItem(const QUuid &dataSourceUid, |
|
43 | void setDataSourceItem(const QUuid &dataSourceUid, | |
44 | std::unique_ptr<DataSourceItem> dataSourceItem) noexcept; |
|
44 | std::unique_ptr<DataSourceItem> dataSourceItem) noexcept; | |
45 |
|
45 | |||
46 | /** |
|
46 | /** | |
47 | * Sets the data provider used to retrieve data from of a data source. The controller takes |
|
47 | * Sets the data provider used to retrieve data from of a data source. The controller takes | |
48 | * ownership of the provider. |
|
48 | * ownership of the provider. | |
49 | * @param dataSourceUid the unique id with which the data source has been registered into the |
|
49 | * @param dataSourceUid the unique id with which the data source has been registered into the | |
50 | * controller. If it is invalid, the method has no effect. |
|
50 | * controller. If it is invalid, the method has no effect. | |
51 | * @param dataProvider the provider of the data source |
|
51 | * @param dataProvider the provider of the data source | |
52 | * @sa registerDataSource() |
|
52 | * @sa registerDataSource() | |
53 | */ |
|
53 | */ | |
54 | void setDataProvider(const QUuid &dataSourceUid, |
|
54 | void setDataProvider(const QUuid &dataSourceUid, | |
55 | std::unique_ptr<IDataProvider> dataProvider) noexcept; |
|
55 | std::unique_ptr<IDataProvider> dataProvider) noexcept; | |
56 |
|
56 | |||
57 | /** |
|
57 | /** | |
58 | * Loads an item (product) as a variable in SciQlop |
|
58 | * Loads an item (product) as a variable in SciQlop | |
59 | * @param dataSourceUid the unique id of the data source containing the item. It is used to get |
|
59 | * @param dataSourceUid the unique id of the data source containing the item. It is used to get | |
60 | * the data provider associated to the data source, and pass it to for the variable creation |
|
60 | * the data provider associated to the data source, and pass it to for the variable creation | |
61 | * @param productItem the item to load |
|
61 | * @param productItem the item to load | |
62 | */ |
|
62 | */ | |
63 | void loadProductItem(const QUuid &dataSourceUid, const DataSourceItem &productItem) noexcept; |
|
63 | void loadProductItem(const QUuid &dataSourceUid, const DataSourceItem &productItem) noexcept; | |
64 |
|
64 | |||
65 | public slots: |
|
65 | public slots: | |
66 | /// Manage init/end of the controller |
|
66 | /// Manage init/end of the controller | |
67 | void initialize(); |
|
67 | void initialize(); | |
68 | void finalize(); |
|
68 | void finalize(); | |
69 |
|
69 | |||
70 | signals: |
|
70 | signals: | |
71 | /// Signal emitted when a structure has been set for a data source |
|
71 | /// Signal emitted when a structure has been set for a data source | |
72 | void dataSourceItemSet(DataSourceItem *dataSourceItem); |
|
72 | void dataSourceItemSet(DataSourceItem *dataSourceItem); | |
73 |
|
73 | |||
|
74 | /** | |||
|
75 | * Signal emitted when a variable creation is asked for a product | |||
|
76 | * @param variableName the name of the variable | |||
|
77 | * @param variableProvider the provider that will be used to retrieve the data of the variable | |||
|
78 | * (can be null) | |||
|
79 | */ | |||
|
80 | void variableCreationRequested(const QString &variableName, | |||
|
81 | std::shared_ptr<IDataProvider> variableProvider); | |||
|
82 | ||||
74 | private: |
|
83 | private: | |
75 | void waitForFinish(); |
|
84 | void waitForFinish(); | |
76 |
|
85 | |||
77 | class DataSourceControllerPrivate; |
|
86 | class DataSourceControllerPrivate; | |
78 | spimpl::unique_impl_ptr<DataSourceControllerPrivate> impl; |
|
87 | spimpl::unique_impl_ptr<DataSourceControllerPrivate> impl; | |
79 | }; |
|
88 | }; | |
80 |
|
89 | |||
81 | #endif // SCIQLOP_DATASOURCECONTROLLER_H |
|
90 | #endif // SCIQLOP_DATASOURCECONTROLLER_H |
@@ -1,111 +1,114 | |||||
1 | #include <DataSource/DataSourceController.h> |
|
1 | #include <DataSource/DataSourceController.h> | |
2 | #include <DataSource/DataSourceItem.h> |
|
2 | #include <DataSource/DataSourceItem.h> | |
3 |
|
3 | |||
4 | #include <Data/IDataProvider.h> |
|
4 | #include <Data/IDataProvider.h> | |
5 |
|
5 | |||
6 | #include <QMutex> |
|
6 | #include <QMutex> | |
7 | #include <QThread> |
|
7 | #include <QThread> | |
8 |
|
8 | |||
9 | #include <QDir> |
|
9 | #include <QDir> | |
10 | #include <QStandardPaths> |
|
10 | #include <QStandardPaths> | |
11 |
|
11 | |||
12 | Q_LOGGING_CATEGORY(LOG_DataSourceController, "DataSourceController") |
|
12 | Q_LOGGING_CATEGORY(LOG_DataSourceController, "DataSourceController") | |
13 |
|
13 | |||
14 | class DataSourceController::DataSourceControllerPrivate { |
|
14 | class DataSourceController::DataSourceControllerPrivate { | |
15 | public: |
|
15 | public: | |
16 | QMutex m_WorkingMutex; |
|
16 | QMutex m_WorkingMutex; | |
17 | /// Data sources registered |
|
17 | /// Data sources registered | |
18 | QHash<QUuid, QString> m_DataSources; |
|
18 | QHash<QUuid, QString> m_DataSources; | |
19 | /// Data sources structures |
|
19 | /// Data sources structures | |
20 | std::map<QUuid, std::unique_ptr<DataSourceItem> > m_DataSourceItems; |
|
20 | std::map<QUuid, std::unique_ptr<DataSourceItem> > m_DataSourceItems; | |
21 | /// Data providers registered |
|
21 | /// Data providers registered | |
22 | /// @remarks Data providers are stored as shared_ptr as they can be sent to a variable and |
|
22 | /// @remarks Data providers are stored as shared_ptr as they can be sent to a variable and | |
23 | /// continue to live without necessarily the data source controller |
|
23 | /// continue to live without necessarily the data source controller | |
24 | std::map<QUuid, std::shared_ptr<IDataProvider> > m_DataProviders; |
|
24 | std::map<QUuid, std::shared_ptr<IDataProvider> > m_DataProviders; | |
25 | }; |
|
25 | }; | |
26 |
|
26 | |||
27 | DataSourceController::DataSourceController(QObject *parent) |
|
27 | DataSourceController::DataSourceController(QObject *parent) | |
28 | : impl{spimpl::make_unique_impl<DataSourceControllerPrivate>()} |
|
28 | : impl{spimpl::make_unique_impl<DataSourceControllerPrivate>()} | |
29 | { |
|
29 | { | |
30 | qCDebug(LOG_DataSourceController()) << tr("DataSourceController construction") |
|
30 | qCDebug(LOG_DataSourceController()) << tr("DataSourceController construction") | |
31 | << QThread::currentThread(); |
|
31 | << QThread::currentThread(); | |
32 | } |
|
32 | } | |
33 |
|
33 | |||
34 | DataSourceController::~DataSourceController() |
|
34 | DataSourceController::~DataSourceController() | |
35 | { |
|
35 | { | |
36 | qCDebug(LOG_DataSourceController()) << tr("DataSourceController destruction") |
|
36 | qCDebug(LOG_DataSourceController()) << tr("DataSourceController destruction") | |
37 | << QThread::currentThread(); |
|
37 | << QThread::currentThread(); | |
38 | this->waitForFinish(); |
|
38 | this->waitForFinish(); | |
39 | } |
|
39 | } | |
40 |
|
40 | |||
41 | QUuid DataSourceController::registerDataSource(const QString &dataSourceName) noexcept |
|
41 | QUuid DataSourceController::registerDataSource(const QString &dataSourceName) noexcept | |
42 | { |
|
42 | { | |
43 | auto dataSourceUid = QUuid::createUuid(); |
|
43 | auto dataSourceUid = QUuid::createUuid(); | |
44 | impl->m_DataSources.insert(dataSourceUid, dataSourceName); |
|
44 | impl->m_DataSources.insert(dataSourceUid, dataSourceName); | |
45 |
|
45 | |||
46 | return dataSourceUid; |
|
46 | return dataSourceUid; | |
47 | } |
|
47 | } | |
48 |
|
48 | |||
49 | void DataSourceController::setDataSourceItem( |
|
49 | void DataSourceController::setDataSourceItem( | |
50 | const QUuid &dataSourceUid, std::unique_ptr<DataSourceItem> dataSourceItem) noexcept |
|
50 | const QUuid &dataSourceUid, std::unique_ptr<DataSourceItem> dataSourceItem) noexcept | |
51 | { |
|
51 | { | |
52 | if (impl->m_DataSources.contains(dataSourceUid)) { |
|
52 | if (impl->m_DataSources.contains(dataSourceUid)) { | |
53 | // The data provider is implicitly converted to a shared_ptr |
|
53 | // The data provider is implicitly converted to a shared_ptr | |
54 | impl->m_DataSourceItems.insert(std::make_pair(dataSourceUid, std::move(dataSourceItem))); |
|
54 | impl->m_DataSourceItems.insert(std::make_pair(dataSourceUid, std::move(dataSourceItem))); | |
55 |
|
55 | |||
56 | // Retrieves the data source item to emit the signal with it |
|
56 | // Retrieves the data source item to emit the signal with it | |
57 | auto it = impl->m_DataSourceItems.find(dataSourceUid); |
|
57 | auto it = impl->m_DataSourceItems.find(dataSourceUid); | |
58 | if (it != impl->m_DataSourceItems.end()) { |
|
58 | if (it != impl->m_DataSourceItems.end()) { | |
59 | emit dataSourceItemSet(it->second.get()); |
|
59 | emit dataSourceItemSet(it->second.get()); | |
60 | } |
|
60 | } | |
61 | } |
|
61 | } | |
62 | else { |
|
62 | else { | |
63 | qCWarning(LOG_DataSourceController()) << tr("Can't set data source item for uid %1 : no " |
|
63 | qCWarning(LOG_DataSourceController()) << tr("Can't set data source item for uid %1 : no " | |
64 | "data source has been registered with the uid") |
|
64 | "data source has been registered with the uid") | |
65 | .arg(dataSourceUid.toString()); |
|
65 | .arg(dataSourceUid.toString()); | |
66 | } |
|
66 | } | |
67 | } |
|
67 | } | |
68 |
|
68 | |||
69 | void DataSourceController::setDataProvider(const QUuid &dataSourceUid, |
|
69 | void DataSourceController::setDataProvider(const QUuid &dataSourceUid, | |
70 | std::unique_ptr<IDataProvider> dataProvider) noexcept |
|
70 | std::unique_ptr<IDataProvider> dataProvider) noexcept | |
71 | { |
|
71 | { | |
72 | if (impl->m_DataSources.contains(dataSourceUid)) { |
|
72 | if (impl->m_DataSources.contains(dataSourceUid)) { | |
73 | impl->m_DataProviders.insert(std::make_pair(dataSourceUid, std::move(dataProvider))); |
|
73 | impl->m_DataProviders.insert(std::make_pair(dataSourceUid, std::move(dataProvider))); | |
74 | } |
|
74 | } | |
75 | else { |
|
75 | else { | |
76 | qCWarning(LOG_DataSourceController()) << tr("Can't set data provider for uid %1 : no data " |
|
76 | qCWarning(LOG_DataSourceController()) << tr("Can't set data provider for uid %1 : no data " | |
77 | "source has been registered with the uid") |
|
77 | "source has been registered with the uid") | |
78 | .arg(dataSourceUid.toString()); |
|
78 | .arg(dataSourceUid.toString()); | |
79 | } |
|
79 | } | |
80 | } |
|
80 | } | |
81 |
|
81 | |||
82 | void DataSourceController::loadProductItem(const QUuid &dataSourceUid, |
|
82 | void DataSourceController::loadProductItem(const QUuid &dataSourceUid, | |
83 | const DataSourceItem &productItem) noexcept |
|
83 | const DataSourceItem &productItem) noexcept | |
84 | { |
|
84 | { | |
85 | if (productItem.type() == DataSourceItemType::PRODUCT) { |
|
85 | if (productItem.type() == DataSourceItemType::PRODUCT) { | |
86 | /// Retrieves the data provider of the data source (if any) |
|
86 | /// Retrieves the data provider of the data source (if any) | |
87 | auto it = impl->m_DataProviders.find(dataSourceUid); |
|
87 | auto it = impl->m_DataProviders.find(dataSourceUid); | |
88 | auto dataProvider = (it != impl->m_DataProviders.end()) ? it->second : nullptr; |
|
88 | auto dataProvider = (it != impl->m_DataProviders.end()) ? it->second : nullptr; | |
|
89 | ||||
|
90 | /// @todo retrieve timerange, and pass it to the signal | |||
|
91 | emit variableCreationRequested(productItem.name(), dataProvider); | |||
89 | } |
|
92 | } | |
90 | else { |
|
93 | else { | |
91 | qCWarning(LOG_DataSourceController()) << tr("Can't load an item that is not a product"); |
|
94 | qCWarning(LOG_DataSourceController()) << tr("Can't load an item that is not a product"); | |
92 | } |
|
95 | } | |
93 | } |
|
96 | } | |
94 |
|
97 | |||
95 | void DataSourceController::initialize() |
|
98 | void DataSourceController::initialize() | |
96 | { |
|
99 | { | |
97 | qCDebug(LOG_DataSourceController()) << tr("DataSourceController init") |
|
100 | qCDebug(LOG_DataSourceController()) << tr("DataSourceController init") | |
98 | << QThread::currentThread(); |
|
101 | << QThread::currentThread(); | |
99 | impl->m_WorkingMutex.lock(); |
|
102 | impl->m_WorkingMutex.lock(); | |
100 | qCDebug(LOG_DataSourceController()) << tr("DataSourceController init END"); |
|
103 | qCDebug(LOG_DataSourceController()) << tr("DataSourceController init END"); | |
101 | } |
|
104 | } | |
102 |
|
105 | |||
103 | void DataSourceController::finalize() |
|
106 | void DataSourceController::finalize() | |
104 | { |
|
107 | { | |
105 | impl->m_WorkingMutex.unlock(); |
|
108 | impl->m_WorkingMutex.unlock(); | |
106 | } |
|
109 | } | |
107 |
|
110 | |||
108 | void DataSourceController::waitForFinish() |
|
111 | void DataSourceController::waitForFinish() | |
109 | { |
|
112 | { | |
110 | QMutexLocker locker{&impl->m_WorkingMutex}; |
|
113 | QMutexLocker locker{&impl->m_WorkingMutex}; | |
111 | } |
|
114 | } |
@@ -1,91 +1,103 | |||||
1 | #include "SqpApplication.h" |
|
1 | #include "SqpApplication.h" | |
2 |
|
2 | |||
|
3 | #include <Data/IDataProvider.h> | |||
3 | #include <DataSource/DataSourceController.h> |
|
4 | #include <DataSource/DataSourceController.h> | |
4 | #include <QThread> |
|
5 | #include <QThread> | |
5 | #include <Variable/VariableController.h> |
|
6 | #include <Variable/VariableController.h> | |
6 | #include <Visualization/VisualizationController.h> |
|
7 | #include <Visualization/VisualizationController.h> | |
7 |
|
8 | |||
8 | Q_LOGGING_CATEGORY(LOG_SqpApplication, "SqpApplication") |
|
9 | Q_LOGGING_CATEGORY(LOG_SqpApplication, "SqpApplication") | |
9 |
|
10 | |||
10 | class SqpApplication::SqpApplicationPrivate { |
|
11 | class SqpApplication::SqpApplicationPrivate { | |
11 | public: |
|
12 | public: | |
12 | SqpApplicationPrivate() |
|
13 | SqpApplicationPrivate() | |
13 | : m_DataSourceController{std::make_unique<DataSourceController>()}, |
|
14 | : m_DataSourceController{std::make_unique<DataSourceController>()}, | |
14 | m_VariableController{std::make_unique<VariableController>()}, |
|
15 | m_VariableController{std::make_unique<VariableController>()}, | |
15 | m_VisualizationController{std::make_unique<VisualizationController>()} |
|
16 | m_VisualizationController{std::make_unique<VisualizationController>()} | |
16 | { |
|
17 | { | |
|
18 | // /////////////////////////////// // | |||
|
19 | // Connections between controllers // | |||
|
20 | // /////////////////////////////// // | |||
|
21 | ||||
|
22 | // VariableController <-> DataSourceController | |||
|
23 | qRegisterMetaType<std::shared_ptr<IDataProvider> >(); | |||
|
24 | connect(m_DataSourceController.get(), | |||
|
25 | SIGNAL(variableCreationRequested(const QString &, std::shared_ptr<IDataProvider>)), | |||
|
26 | m_VariableController.get(), | |||
|
27 | SLOT(createVariable(const QString &, std::shared_ptr<IDataProvider>))); | |||
|
28 | ||||
17 | m_DataSourceController->moveToThread(&m_DataSourceControllerThread); |
|
29 | m_DataSourceController->moveToThread(&m_DataSourceControllerThread); | |
18 | m_VariableController->moveToThread(&m_VariableControllerThread); |
|
30 | m_VariableController->moveToThread(&m_VariableControllerThread); | |
19 | m_VisualizationController->moveToThread(&m_VisualizationControllerThread); |
|
31 | m_VisualizationController->moveToThread(&m_VisualizationControllerThread); | |
20 | } |
|
32 | } | |
21 |
|
33 | |||
22 | virtual ~SqpApplicationPrivate() |
|
34 | virtual ~SqpApplicationPrivate() | |
23 | { |
|
35 | { | |
24 | qCInfo(LOG_SqpApplication()) << tr("SqpApplicationPrivate destruction"); |
|
36 | qCInfo(LOG_SqpApplication()) << tr("SqpApplicationPrivate destruction"); | |
25 | m_DataSourceControllerThread.quit(); |
|
37 | m_DataSourceControllerThread.quit(); | |
26 | m_DataSourceControllerThread.wait(); |
|
38 | m_DataSourceControllerThread.wait(); | |
27 |
|
39 | |||
28 | m_VariableControllerThread.quit(); |
|
40 | m_VariableControllerThread.quit(); | |
29 | m_VariableControllerThread.wait(); |
|
41 | m_VariableControllerThread.wait(); | |
30 |
|
42 | |||
31 | m_VisualizationControllerThread.quit(); |
|
43 | m_VisualizationControllerThread.quit(); | |
32 | m_VisualizationControllerThread.wait(); |
|
44 | m_VisualizationControllerThread.wait(); | |
33 | } |
|
45 | } | |
34 |
|
46 | |||
35 | std::unique_ptr<DataSourceController> m_DataSourceController; |
|
47 | std::unique_ptr<DataSourceController> m_DataSourceController; | |
36 | std::unique_ptr<VariableController> m_VariableController; |
|
48 | std::unique_ptr<VariableController> m_VariableController; | |
37 | std::unique_ptr<VisualizationController> m_VisualizationController; |
|
49 | std::unique_ptr<VisualizationController> m_VisualizationController; | |
38 | QThread m_DataSourceControllerThread; |
|
50 | QThread m_DataSourceControllerThread; | |
39 | QThread m_VariableControllerThread; |
|
51 | QThread m_VariableControllerThread; | |
40 | QThread m_VisualizationControllerThread; |
|
52 | QThread m_VisualizationControllerThread; | |
41 | }; |
|
53 | }; | |
42 |
|
54 | |||
43 |
|
55 | |||
44 | SqpApplication::SqpApplication(int &argc, char **argv) |
|
56 | SqpApplication::SqpApplication(int &argc, char **argv) | |
45 | : QApplication{argc, argv}, impl{spimpl::make_unique_impl<SqpApplicationPrivate>()} |
|
57 | : QApplication{argc, argv}, impl{spimpl::make_unique_impl<SqpApplicationPrivate>()} | |
46 | { |
|
58 | { | |
47 | qCInfo(LOG_SqpApplication()) << tr("SqpApplication construction"); |
|
59 | qCInfo(LOG_SqpApplication()) << tr("SqpApplication construction"); | |
48 |
|
60 | |||
49 | connect(&impl->m_DataSourceControllerThread, &QThread::started, |
|
61 | connect(&impl->m_DataSourceControllerThread, &QThread::started, | |
50 | impl->m_DataSourceController.get(), &DataSourceController::initialize); |
|
62 | impl->m_DataSourceController.get(), &DataSourceController::initialize); | |
51 | connect(&impl->m_DataSourceControllerThread, &QThread::finished, |
|
63 | connect(&impl->m_DataSourceControllerThread, &QThread::finished, | |
52 | impl->m_DataSourceController.get(), &DataSourceController::finalize); |
|
64 | impl->m_DataSourceController.get(), &DataSourceController::finalize); | |
53 |
|
65 | |||
54 | connect(&impl->m_VariableControllerThread, &QThread::started, impl->m_VariableController.get(), |
|
66 | connect(&impl->m_VariableControllerThread, &QThread::started, impl->m_VariableController.get(), | |
55 | &VariableController::initialize); |
|
67 | &VariableController::initialize); | |
56 | connect(&impl->m_VariableControllerThread, &QThread::finished, impl->m_VariableController.get(), |
|
68 | connect(&impl->m_VariableControllerThread, &QThread::finished, impl->m_VariableController.get(), | |
57 | &VariableController::finalize); |
|
69 | &VariableController::finalize); | |
58 |
|
70 | |||
59 | connect(&impl->m_VisualizationControllerThread, &QThread::started, |
|
71 | connect(&impl->m_VisualizationControllerThread, &QThread::started, | |
60 | impl->m_VisualizationController.get(), &VisualizationController::initialize); |
|
72 | impl->m_VisualizationController.get(), &VisualizationController::initialize); | |
61 | connect(&impl->m_VisualizationControllerThread, &QThread::finished, |
|
73 | connect(&impl->m_VisualizationControllerThread, &QThread::finished, | |
62 | impl->m_VisualizationController.get(), &VisualizationController::finalize); |
|
74 | impl->m_VisualizationController.get(), &VisualizationController::finalize); | |
63 |
|
75 | |||
64 |
|
76 | |||
65 | impl->m_DataSourceControllerThread.start(); |
|
77 | impl->m_DataSourceControllerThread.start(); | |
66 | impl->m_VariableControllerThread.start(); |
|
78 | impl->m_VariableControllerThread.start(); | |
67 | impl->m_VisualizationControllerThread.start(); |
|
79 | impl->m_VisualizationControllerThread.start(); | |
68 | } |
|
80 | } | |
69 |
|
81 | |||
70 | SqpApplication::~SqpApplication() |
|
82 | SqpApplication::~SqpApplication() | |
71 | { |
|
83 | { | |
72 | } |
|
84 | } | |
73 |
|
85 | |||
74 | void SqpApplication::initialize() |
|
86 | void SqpApplication::initialize() | |
75 | { |
|
87 | { | |
76 | } |
|
88 | } | |
77 |
|
89 | |||
78 | DataSourceController &SqpApplication::dataSourceController() noexcept |
|
90 | DataSourceController &SqpApplication::dataSourceController() noexcept | |
79 | { |
|
91 | { | |
80 | return *impl->m_DataSourceController; |
|
92 | return *impl->m_DataSourceController; | |
81 | } |
|
93 | } | |
82 |
|
94 | |||
83 | VariableController &SqpApplication::variableController() noexcept |
|
95 | VariableController &SqpApplication::variableController() noexcept | |
84 | { |
|
96 | { | |
85 | return *impl->m_VariableController; |
|
97 | return *impl->m_VariableController; | |
86 | } |
|
98 | } | |
87 |
|
99 | |||
88 | VisualizationController &SqpApplication::visualizationController() noexcept |
|
100 | VisualizationController &SqpApplication::visualizationController() noexcept | |
89 | { |
|
101 | { | |
90 | return *impl->m_VisualizationController; |
|
102 | return *impl->m_VisualizationController; | |
91 | } |
|
103 | } |
General Comments 0
You need to be logged in to leave comments.
Login now