##// END OF EJS Templates
Generates and registers clone provider
Alexandre Leroux -
r712:951cc05bf337
parent child
Show More
@@ -32,6 +32,7 class SCIQLOP_CORE_EXPORT IDataProvider : public QObject {
32 Q_OBJECT
32 Q_OBJECT
33 public:
33 public:
34 virtual ~IDataProvider() noexcept = default;
34 virtual ~IDataProvider() noexcept = default;
35 virtual std::shared_ptr<IDataProvider> clone() const = 0;
35
36
36 /**
37 /**
37 * @brief requestDataLoading provide datas for the data identified by acqIdentifier and
38 * @brief requestDataLoading provide datas for the data identified by acqIdentifier and
@@ -201,6 +201,15 VariableController::cloneVariable(std::shared_ptr<Variable> variable) noexcept
201 // Generates clone identifier
201 // Generates clone identifier
202 impl->m_VariableToIdentifierMap[duplicate] = QUuid::createUuid();
202 impl->m_VariableToIdentifierMap[duplicate] = QUuid::createUuid();
203
203
204 // Registers provider
205 auto variableProvider = impl->m_VariableToProviderMap.at(variable);
206 auto duplicateProvider = variableProvider != nullptr ? variableProvider->clone() : nullptr;
207
208 impl->m_VariableToProviderMap[duplicate] = duplicateProvider;
209 if (duplicateProvider) {
210 impl->registerProvider(duplicateProvider);
211 }
212
204 return duplicate;
213 return duplicate;
205 }
214 }
206 else {
215 else {
@@ -12,6 +12,8 namespace {
12
12
13 /// Provider used for the tests
13 /// Provider used for the tests
14 class TestProvider : public IDataProvider {
14 class TestProvider : public IDataProvider {
15 std::shared_ptr<IDataProvider> clone() const { return std::make_shared<TestProvider>(); }
16
15 void requestDataLoading(QUuid acqIdentifier, const DataProviderParameters &parameters) override
17 void requestDataLoading(QUuid acqIdentifier, const DataProviderParameters &parameters) override
16 {
18 {
17 // Does nothing
19 // Does nothing
@@ -18,6 +18,7 class QNetworkReply;
18 class SCIQLOP_AMDA_EXPORT AmdaProvider : public IDataProvider {
18 class SCIQLOP_AMDA_EXPORT AmdaProvider : public IDataProvider {
19 public:
19 public:
20 explicit AmdaProvider();
20 explicit AmdaProvider();
21 std::shared_ptr<IDataProvider> clone() const override;
21
22
22 void requestDataLoading(QUuid acqIdentifier, const DataProviderParameters &parameters) override;
23 void requestDataLoading(QUuid acqIdentifier, const DataProviderParameters &parameters) override;
23
24
@@ -68,6 +68,12 AmdaProvider::AmdaProvider()
68 }
68 }
69 }
69 }
70
70
71 std::shared_ptr<IDataProvider> AmdaProvider::clone() const
72 {
73 // No copy is made in the clone
74 return std::make_shared<AmdaProvider>();
75 }
76
71 void AmdaProvider::requestDataLoading(QUuid acqIdentifier, const DataProviderParameters &parameters)
77 void AmdaProvider::requestDataLoading(QUuid acqIdentifier, const DataProviderParameters &parameters)
72 {
78 {
73 // NOTE: Try to use multithread if possible
79 // NOTE: Try to use multithread if possible
@@ -16,6 +16,8 Q_DECLARE_LOGGING_CATEGORY(LOG_CosinusProvider)
16 */
16 */
17 class SCIQLOP_MOCKPLUGIN_EXPORT CosinusProvider : public IDataProvider {
17 class SCIQLOP_MOCKPLUGIN_EXPORT CosinusProvider : public IDataProvider {
18 public:
18 public:
19 std::shared_ptr<IDataProvider> clone() const override;
20
19 /// @sa IDataProvider::requestDataLoading(). The current impl isn't thread safe.
21 /// @sa IDataProvider::requestDataLoading(). The current impl isn't thread safe.
20 void requestDataLoading(QUuid acqIdentifier, const DataProviderParameters &parameters) override;
22 void requestDataLoading(QUuid acqIdentifier, const DataProviderParameters &parameters) override;
21
23
@@ -11,6 +11,12
11
11
12 Q_LOGGING_CATEGORY(LOG_CosinusProvider, "CosinusProvider")
12 Q_LOGGING_CATEGORY(LOG_CosinusProvider, "CosinusProvider")
13
13
14 std::shared_ptr<IDataProvider> CosinusProvider::clone() const
15 {
16 // No copy is made in clone
17 return std::make_shared<CosinusProvider>();
18 }
19
14 std::shared_ptr<IDataSeries> CosinusProvider::retrieveData(QUuid acqIdentifier,
20 std::shared_ptr<IDataSeries> CosinusProvider::retrieveData(QUuid acqIdentifier,
15 const SqpRange &dataRangeRequested)
21 const SqpRange &dataRangeRequested)
16 {
22 {
General Comments 0
You need to be logged in to leave comments. Login now