@@ -35,7 +35,7 signals: | |||||
35 |
|
35 | |||
36 | public slots: |
|
36 | public slots: | |
37 | /// Slot called when a new dateTime has been defined. |
|
37 | /// Slot called when a new dateTime has been defined. | |
38 |
void |
|
38 | void setDateTimeRange(SqpRange dateTime); | |
39 |
|
39 | |||
40 | /// Slot called when the dateTime has to be notified. Call timeUpdated signal |
|
40 | /// Slot called when the dateTime has to be notified. Call timeUpdated signal | |
41 | void onTimeNotify(); |
|
41 | void onTimeNotify(); |
@@ -39,7 +39,6 public: | |||||
39 | VariableModel *variableModel() noexcept; |
|
39 | VariableModel *variableModel() noexcept; | |
40 | QItemSelectionModel *variableSelectionModel() noexcept; |
|
40 | QItemSelectionModel *variableSelectionModel() noexcept; | |
41 |
|
41 | |||
42 | void setTimeController(TimeController *timeController) noexcept; |
|
|||
43 |
|
42 | |||
44 | /** |
|
43 | /** | |
45 | * Clones the variable passed in parameter and adds the duplicate to the controller |
|
44 | * Clones the variable passed in parameter and adds the duplicate to the controller | |
@@ -106,7 +105,7 public slots: | |||||
106 | * @return the pointer to the new variable or nullptr if the creation failed |
|
105 | * @return the pointer to the new variable or nullptr if the creation failed | |
107 | */ |
|
106 | */ | |
108 | std::shared_ptr<Variable> createVariable(const QString &name, const QVariantHash &metadata, |
|
107 | std::shared_ptr<Variable> createVariable(const QString &name, const QVariantHash &metadata, | |
109 | std::shared_ptr<IDataProvider> provider) noexcept; |
|
108 | std::shared_ptr<IDataProvider> provider, const SqpRange &range) noexcept; | |
110 |
|
109 | |||
111 | /// Update the temporal parameters of every selected variable to dateTime |
|
110 | /// Update the temporal parameters of every selected variable to dateTime | |
112 | void onDateTimeOnSelection(const SqpRange &dateTime); |
|
111 | void onDateTimeOnSelection(const SqpRange &dateTime); |
@@ -40,7 +40,7 SqpRange TimeController::timeRangeForMimeData(const QByteArray &mimeData) | |||||
40 | return timeRange; |
|
40 | return timeRange; | |
41 | } |
|
41 | } | |
42 |
|
42 | |||
43 |
void TimeController:: |
|
43 | void TimeController::setDateTimeRange(SqpRange dateTime) | |
44 | { |
|
44 | { | |
45 | impl->m_DateTime = dateTime; |
|
45 | impl->m_DateTime = dateTime; | |
46 | } |
|
46 | } |
@@ -145,7 +145,6 struct VariableController::VariableControllerPrivate { | |||||
145 | QItemSelectionModel *m_VariableSelectionModel; |
|
145 | QItemSelectionModel *m_VariableSelectionModel; | |
146 |
|
146 | |||
147 |
|
147 | |||
148 | TimeController *m_TimeController{nullptr}; |
|
|||
149 | std::unique_ptr<VariableCacheStrategy> m_VariableCacheStrategy; |
|
148 | std::unique_ptr<VariableCacheStrategy> m_VariableCacheStrategy; | |
150 | std::unique_ptr<VariableAcquisitionWorker> m_VariableAcquisitionWorker; |
|
149 | std::unique_ptr<VariableAcquisitionWorker> m_VariableAcquisitionWorker; | |
151 | QThread m_VariableAcquisitionWorkerThread; |
|
150 | QThread m_VariableAcquisitionWorkerThread; | |
@@ -213,11 +212,6 QItemSelectionModel *VariableController::variableSelectionModel() noexcept | |||||
213 | return impl->m_VariableSelectionModel; |
|
212 | return impl->m_VariableSelectionModel; | |
214 | } |
|
213 | } | |
215 |
|
214 | |||
216 | void VariableController::setTimeController(TimeController *timeController) noexcept |
|
|||
217 | { |
|
|||
218 | impl->m_TimeController = timeController; |
|
|||
219 | } |
|
|||
220 |
|
||||
221 | std::shared_ptr<Variable> |
|
215 | std::shared_ptr<Variable> | |
222 | VariableController::cloneVariable(std::shared_ptr<Variable> variable) noexcept |
|
216 | VariableController::cloneVariable(std::shared_ptr<Variable> variable) noexcept | |
223 | { |
|
217 | { | |
@@ -339,15 +333,15 VariableController::variablesForMimeData(const QByteArray &mimeData) const | |||||
339 |
|
333 | |||
340 | std::shared_ptr<Variable> |
|
334 | std::shared_ptr<Variable> | |
341 | VariableController::createVariable(const QString &name, const QVariantHash &metadata, |
|
335 | VariableController::createVariable(const QString &name, const QVariantHash &metadata, | |
342 | std::shared_ptr<IDataProvider> provider) noexcept |
|
336 | std::shared_ptr<IDataProvider> provider, const SqpRange& range) noexcept | |
343 | { |
|
337 | { | |
344 | if (!impl->m_TimeController) { |
|
338 | // if (!impl->m_TimeController) { | |
345 | qCCritical(LOG_VariableController()) |
|
339 | // qCCritical(LOG_VariableController()) | |
346 | << tr("Impossible to create variable: The time controller is null"); |
|
340 | // << tr("Impossible to create variable: The time controller is null"); | |
347 | return nullptr; |
|
341 | // return nullptr; | |
348 | } |
|
342 | // } | |
349 |
|
343 | |||
350 | auto range = impl->m_TimeController->dateTime(); |
|
344 | // auto range = impl->m_TimeController->dateTime(); | |
351 |
|
345 | |||
352 | if (auto newVariable = impl->m_VariableModel->createVariable(name, metadata)) { |
|
346 | if (auto newVariable = impl->m_VariableModel->createVariable(name, metadata)) { | |
353 | auto varId = QUuid::createUuid(); |
|
347 | auto varId = QUuid::createUuid(); |
@@ -32,7 +32,7 std::unique_ptr<TimeController> defaultTimeController() | |||||
32 |
|
32 | |||
33 | QDateTime start{QDate{2017, 01, 01}, QTime{0, 0, 0, 0}}; |
|
33 | QDateTime start{QDate{2017, 01, 01}, QTime{0, 0, 0, 0}}; | |
34 | QDateTime end{QDate{2017, 01, 02}, QTime{0, 0, 0, 0}}; |
|
34 | QDateTime end{QDate{2017, 01, 02}, QTime{0, 0, 0, 0}}; | |
35 |
timeController-> |
|
35 | timeController->setDateTimeRange( | |
36 | SqpRange{DateUtils::secondsSinceEpoch(start), DateUtils::secondsSinceEpoch(end)}); |
|
36 | SqpRange{DateUtils::secondsSinceEpoch(start), DateUtils::secondsSinceEpoch(end)}); | |
37 |
|
37 | |||
38 | return timeController; |
|
38 | return timeController; | |
@@ -53,11 +53,11 void TestVariableController::testDeleteVariable() | |||||
53 | // Creates variable controller |
|
53 | // Creates variable controller | |
54 | auto timeController = defaultTimeController(); |
|
54 | auto timeController = defaultTimeController(); | |
55 | VariableController variableController{}; |
|
55 | VariableController variableController{}; | |
56 | variableController.setTimeController(timeController.get()); |
|
56 | //variableController.setTimeController(timeController.get()); | |
57 |
|
57 | |||
58 | // Creates a variable from the controller |
|
58 | // Creates a variable from the controller | |
59 | auto variable |
|
59 | auto variable | |
60 | = variableController.createVariable("variable", {}, std::make_shared<TestProvider>()); |
|
60 | = variableController.createVariable("variable", {}, std::make_shared<TestProvider>(), timeController->dateTime()); | |
61 |
|
61 | |||
62 | qDebug() << QString::number(variable.use_count()); |
|
62 | qDebug() << QString::number(variable.use_count()); | |
63 |
|
63 |
@@ -112,15 +112,15 struct IOperation { | |||||
112 | *Variable creation operation in the controller |
|
112 | *Variable creation operation in the controller | |
113 | */ |
|
113 | */ | |
114 | struct Create : public IOperation { |
|
114 | struct Create : public IOperation { | |
115 | explicit Create(int index) : m_Index{index} {} |
|
115 | explicit Create(int index, const SqpRange &range) : m_Index{index},m_range(range) {} | |
116 |
|
116 | |||
117 | void exec(VariableController &variableController) const override |
|
117 | void exec(VariableController &variableController) const override | |
118 | { |
|
118 | { | |
119 | auto variable = variableController.createVariable(QString::number(m_Index), {}, |
|
119 | auto variable = variableController.createVariable(QString::number(m_Index), {}, | |
120 | std::make_unique<TestProvider>()); |
|
120 | std::make_unique<TestProvider>(), m_range); | |
121 | } |
|
121 | } | |
122 |
|
||||
123 | int m_Index; ///< The index of the variable to create in the controller |
|
122 | int m_Index; ///< The index of the variable to create in the controller | |
|
123 | SqpRange m_range; | |||
124 | }; |
|
124 | }; | |
125 |
|
125 | |||
126 | /** |
|
126 | /** | |
@@ -227,10 +227,10 void testSyncCase1() | |||||
227 |
|
227 | |||
228 | Iterations iterations{}; |
|
228 | Iterations iterations{}; | |
229 | // Creates variables var0, var1 and var2 |
|
229 | // Creates variables var0, var1 and var2 | |
230 | iterations.push_back({std::make_shared<Create>(0), {{0, initialRange}}}); |
|
230 | iterations.push_back({std::make_shared<Create>(0, initialRange), {{0, initialRange}}}); | |
231 | iterations.push_back({std::make_shared<Create>(1), {{0, initialRange}, {1, initialRange}}}); |
|
231 | iterations.push_back({std::make_shared<Create>(1, initialRange), {{0, initialRange}, {1, initialRange}}}); | |
232 | iterations.push_back( |
|
232 | iterations.push_back( | |
233 | {std::make_shared<Create>(2), {{0, initialRange}, {1, initialRange}, {2, initialRange}}}); |
|
233 | {std::make_shared<Create>(2, initialRange), {{0, initialRange}, {1, initialRange}, {2, initialRange}}}); | |
234 |
|
234 | |||
235 | // Adds variables into the sync group (ranges don't need to be tested here) |
|
235 | // Adds variables into the sync group (ranges don't need to be tested here) | |
236 | iterations.push_back({std::make_shared<Synchronize>(0, syncId)}); |
|
236 | iterations.push_back({std::make_shared<Synchronize>(0, syncId)}); | |
@@ -302,8 +302,8 void testSyncCase2() | |||||
302 |
|
302 | |||
303 | Iterations iterations{}; |
|
303 | Iterations iterations{}; | |
304 | // Creates variables var0 and var1 |
|
304 | // Creates variables var0 and var1 | |
305 | iterations.push_back({std::make_shared<Create>(0), {{0, initialRange}}}); |
|
305 | iterations.push_back({std::make_shared<Create>(0, initialRange), {{0, initialRange}}}); | |
306 | iterations.push_back({std::make_shared<Create>(1), {{0, initialRange}, {1, initialRange}}}); |
|
306 | iterations.push_back({std::make_shared<Create>(1, initialRange), {{0, initialRange}, {1, initialRange}}}); | |
307 |
|
307 | |||
308 | // Adds variables into the sync group (ranges don't need to be tested here) |
|
308 | // Adds variables into the sync group (ranges don't need to be tested here) | |
309 | iterations.push_back({std::make_shared<Synchronize>(0, syncId)}); |
|
309 | iterations.push_back({std::make_shared<Synchronize>(0, syncId)}); | |
@@ -361,7 +361,7 void testSyncOnVarCase1() | |||||
361 |
|
361 | |||
362 | Iterations creations{}; |
|
362 | Iterations creations{}; | |
363 | // Creates variables var0, var1 and var2 |
|
363 | // Creates variables var0, var1 and var2 | |
364 | creations.push_back({std::make_shared<Create>(0), {{0, initialRange}}}); |
|
364 | creations.push_back({std::make_shared<Create>(0, initialRange), {{0, initialRange}}}); | |
365 |
|
365 | |||
366 | Iterations synchronization{}; |
|
366 | Iterations synchronization{}; | |
367 | // Adds variables into the sync group (ranges don't need to be tested here) |
|
367 | // Adds variables into the sync group (ranges don't need to be tested here) | |
@@ -447,11 +447,11 void TestVariableSync::testSync() | |||||
447 | // Inits controllers |
|
447 | // Inits controllers | |
448 | TimeController timeController{}; |
|
448 | TimeController timeController{}; | |
449 | VariableController variableController{}; |
|
449 | VariableController variableController{}; | |
450 | variableController.setTimeController(&timeController); |
|
450 | //variableController.setTimeController(&timeController); | |
451 |
|
451 | |||
452 | QFETCH(QUuid, syncId); |
|
452 | QFETCH(QUuid, syncId); | |
453 | QFETCH(SqpRange, initialRange); |
|
453 | QFETCH(SqpRange, initialRange); | |
454 |
timeController. |
|
454 | timeController.setDateTimeRange(initialRange); | |
455 |
|
455 | |||
456 | // Synchronization group used |
|
456 | // Synchronization group used | |
457 | variableController.onAddSynchronizationGroupId(syncId); |
|
457 | variableController.onAddSynchronizationGroupId(syncId); | |
@@ -474,11 +474,11 void TestVariableSync::testSyncOneVar() | |||||
474 | // Inits controllers |
|
474 | // Inits controllers | |
475 | TimeController timeController{}; |
|
475 | TimeController timeController{}; | |
476 | VariableController variableController{}; |
|
476 | VariableController variableController{}; | |
477 | variableController.setTimeController(&timeController); |
|
477 | //variableController.setTimeController(&timeController); | |
478 |
|
478 | |||
479 | QFETCH(QUuid, syncId); |
|
479 | QFETCH(QUuid, syncId); | |
480 | QFETCH(SqpRange, initialRange); |
|
480 | QFETCH(SqpRange, initialRange); | |
481 |
timeController. |
|
481 | timeController.setDateTimeRange(initialRange); | |
482 |
|
482 | |||
483 | // Synchronization group used |
|
483 | // Synchronization group used | |
484 | variableController.onAddSynchronizationGroupId(syncId); |
|
484 | variableController.onAddSynchronizationGroupId(syncId); |
@@ -66,7 +66,7 public: | |||||
66 | m_VisualizationControllerThread.setObjectName("VsualizationControllerThread"); |
|
66 | m_VisualizationControllerThread.setObjectName("VsualizationControllerThread"); | |
67 |
|
67 | |||
68 | // Additionnal init |
|
68 | // Additionnal init | |
69 | m_VariableController->setTimeController(m_TimeController.get()); |
|
69 | //m_VariableController->setTimeController(m_TimeController.get()); | |
70 | } |
|
70 | } | |
71 |
|
71 | |||
72 | virtual ~SqpApplicationPrivate() |
|
72 | virtual ~SqpApplicationPrivate() |
@@ -51,7 +51,7 TimeWidget::TimeWidget(QWidget *parent) | |||||
51 | auto dateTime = SqpRange{DateUtils::secondsSinceEpoch(startDateTime), |
|
51 | auto dateTime = SqpRange{DateUtils::secondsSinceEpoch(startDateTime), | |
52 | DateUtils::secondsSinceEpoch(endDateTime)}; |
|
52 | DateUtils::secondsSinceEpoch(endDateTime)}; | |
53 |
|
53 | |||
54 |
sqpApp->timeController(). |
|
54 | sqpApp->timeController().setDateTimeRange(dateTime); | |
55 | } |
|
55 | } | |
56 |
|
56 | |||
57 |
|
57 |
@@ -39,7 +39,7 struct CreateOperation : public IFuzzingOperation { | |||||
39 | << "(metadata:" << variableMetadata << ")..."; |
|
39 | << "(metadata:" << variableMetadata << ")..."; | |
40 |
|
40 | |||
41 | auto newVariable |
|
41 | auto newVariable | |
42 | = variableController.createVariable(variableName, variableMetadata, variableProvider); |
|
42 | = variableController.createVariable(variableName, variableMetadata, variableProvider, properties.value(INITIAL_RANGE_PROPERTY).value<SqpRange>()); | |
43 |
|
43 | |||
44 | // Updates variable's state |
|
44 | // Updates variable's state | |
45 | auto &variableState = fuzzingState.variableState(variableId); |
|
45 | auto &variableState = fuzzingState.variableState(variableId); |
@@ -74,8 +74,8 PYBIND11_MODULE(pytestamda, m){ | |||||
74 |
|
74 | |||
75 | py::class_<VariableController>(m, "VariableController") |
|
75 | py::class_<VariableController>(m, "VariableController") | |
76 | .def_static("createVariable",[](const QString &name, |
|
76 | .def_static("createVariable",[](const QString &name, | |
77 | std::shared_ptr<IDataProvider> provider){ |
|
77 | std::shared_ptr<IDataProvider> provider, const SqpRange& range){ | |
78 | return sqpApp->variableController().createVariable(name, {{"dataType", "vector"}, {"xml:id", "c1_b"}}, provider); |
|
78 | return sqpApp->variableController().createVariable(name, {{"dataType", "vector"}, {"xml:id", "c1_b"}}, provider, range); | |
79 | }) |
|
79 | }) | |
80 | .def_static("hasPendingDownloads", |
|
80 | .def_static("hasPendingDownloads", | |
81 | [](){return sqpApp->variableController().hasPendingDownloads();} |
|
81 | [](){return sqpApp->variableController().hasPendingDownloads();} | |
@@ -106,7 +106,7 PYBIND11_MODULE(pytestamda, m){ | |||||
106 | }); |
|
106 | }); | |
107 |
|
107 | |||
108 | py::class_<TimeController>(m,"TimeController") |
|
108 | py::class_<TimeController>(m,"TimeController") | |
109 |
.def_static("setTime", [](SqpRange range){sqpApp->timeController(). |
|
109 | .def_static("setTime", [](SqpRange range){sqpApp->timeController().setDateTimeRange(range);}); | |
110 |
|
110 | |||
111 |
|
111 | |||
112 | auto amda_provider = std::make_shared<AmdaProvider>(); |
|
112 | auto amda_provider = std::make_shared<AmdaProvider>(); |
@@ -131,10 +131,10 void TestAmdaAcquisition::testAcquisition() | |||||
131 |
|
131 | |||
132 | // Creates variable |
|
132 | // Creates variable | |
133 | QFETCH(SqpRange, initialRange); |
|
133 | QFETCH(SqpRange, initialRange); | |
134 |
sqpApp->timeController(). |
|
134 | sqpApp->timeController().setDateTimeRange(initialRange); | |
135 | auto provider = std::make_shared<AmdaProvider>(); |
|
135 | auto provider = std::make_shared<AmdaProvider>(); | |
136 | auto variable = sqpApp->variableController().createVariable( |
|
136 | auto variable = sqpApp->variableController().createVariable( | |
137 | "bx_gse", {{"dataType", "scalar"}, {"xml:id", "imf(0)"}}, provider); |
|
137 | "bx_gse", {{"dataType", "scalar"}, {"xml:id", "imf(0)"}}, provider, initialRange); | |
138 |
|
138 | |||
139 | QTest::qWait(OPERATION_DELAY); |
|
139 | QTest::qWait(OPERATION_DELAY); | |
140 | validateVariable(variable, initialRange); |
|
140 | validateVariable(variable, initialRange); |
@@ -361,7 +361,7 void TestAmdaFuzzing::testFuzzing() | |||||
361 | // Sets initial range on time controller |
|
361 | // Sets initial range on time controller | |
362 | SqpRange initialRange{initialRangeStart, initialRangeEnd}; |
|
362 | SqpRange initialRange{initialRangeStart, initialRangeEnd}; | |
363 | qCInfo(LOG_TestAmdaFuzzing()).noquote() << "Setting initial range to" << initialRange << "..."; |
|
363 | qCInfo(LOG_TestAmdaFuzzing()).noquote() << "Setting initial range to" << initialRange << "..."; | |
364 |
timeController. |
|
364 | timeController.setDateTimeRange(initialRange); | |
365 | properties.insert(INITIAL_RANGE_PROPERTY, QVariant::fromValue(initialRange)); |
|
365 | properties.insert(INITIAL_RANGE_PROPERTY, QVariant::fromValue(initialRange)); | |
366 |
|
366 | |||
367 | FuzzingTest test{variableController, properties}; |
|
367 | FuzzingTest test{variableController, properties}; |
@@ -21,16 +21,16 std::unique_ptr<IDataProvider> createDataProvider() noexcept | |||||
21 | return std::make_unique<CosinusProvider>(); |
|
21 | return std::make_unique<CosinusProvider>(); | |
22 | } |
|
22 | } | |
23 |
|
23 | |||
24 |
std::unique_ptr<DataSourceItem> createProductItem(const QVariantHash & |
|
24 | std::unique_ptr<DataSourceItem> createProductItem(const QVariantHash &metaData, | |
25 | const QUuid &dataSourceUid) |
|
25 | const QUuid &dataSourceUid) | |
26 | { |
|
26 | { | |
27 |
auto result = std::make_unique<DataSourceItem>(DataSourceItemType::PRODUCT, |
|
27 | auto result = std::make_unique<DataSourceItem>(DataSourceItemType::PRODUCT, metaData); | |
28 |
|
28 | |||
29 | // Adds plugin name to product metadata |
|
29 | // Adds plugin name to product metadata | |
30 | result->setData(DataSourceItem::PLUGIN_DATA_KEY, DATA_SOURCE_NAME); |
|
30 | result->setData(DataSourceItem::PLUGIN_DATA_KEY, DATA_SOURCE_NAME); | |
31 |
result->setData(DataSourceItem::ID_DATA_KEY, |
|
31 | result->setData(DataSourceItem::ID_DATA_KEY, metaData.value(DataSourceItem::NAME_DATA_KEY)); | |
32 |
|
32 | |||
33 |
auto productName = |
|
33 | auto productName = metaData.value(DataSourceItem::NAME_DATA_KEY).toString(); | |
34 |
|
34 | |||
35 | // Add action to load product from DataSourceController |
|
35 | // Add action to load product from DataSourceController | |
36 | result->addAction(std::make_unique<DataSourceItemAction>( |
|
36 | result->addAction(std::make_unique<DataSourceItemAction>( |
@@ -153,10 +153,10 void TestCosinusAcquisition::testAcquisition() | |||||
153 |
|
153 | |||
154 | // Creates variable |
|
154 | // Creates variable | |
155 | QFETCH(SqpRange, initialRange); |
|
155 | QFETCH(SqpRange, initialRange); | |
156 |
sqpApp->timeController(). |
|
156 | sqpApp->timeController().setDateTimeRange(initialRange); | |
157 | auto provider = std::make_shared<CosinusProvider>(); |
|
157 | auto provider = std::make_shared<CosinusProvider>(); | |
158 | auto variable = sqpApp->variableController().createVariable( |
|
158 | auto variable = sqpApp->variableController().createVariable( | |
159 | "MMS", {{COSINUS_TYPE_KEY, "scalar"}, {COSINUS_FREQUENCY_KEY, 10.}}, provider); |
|
159 | "MMS", {{COSINUS_TYPE_KEY, "scalar"}, {COSINUS_FREQUENCY_KEY, 10.}}, provider, initialRange); | |
160 |
|
160 | |||
161 |
|
161 | |||
162 | QFETCH(int, operationDelay); |
|
162 | QFETCH(int, operationDelay); |
General Comments 0
You need to be logged in to leave comments.
Login now