##// 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 32 Q_OBJECT
33 33 public:
34 34 virtual ~IDataProvider() noexcept = default;
35 virtual std::shared_ptr<IDataProvider> clone() const = 0;
35 36
36 37 /**
37 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 201 // Generates clone identifier
202 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 213 return duplicate;
205 214 }
206 215 else {
@@ -12,6 +12,8 namespace {
12 12
13 13 /// Provider used for the tests
14 14 class TestProvider : public IDataProvider {
15 std::shared_ptr<IDataProvider> clone() const { return std::make_shared<TestProvider>(); }
16
15 17 void requestDataLoading(QUuid acqIdentifier, const DataProviderParameters &parameters) override
16 18 {
17 19 // Does nothing
@@ -18,6 +18,7 class QNetworkReply;
18 18 class SCIQLOP_AMDA_EXPORT AmdaProvider : public IDataProvider {
19 19 public:
20 20 explicit AmdaProvider();
21 std::shared_ptr<IDataProvider> clone() const override;
21 22
22 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 77 void AmdaProvider::requestDataLoading(QUuid acqIdentifier, const DataProviderParameters &parameters)
72 78 {
73 79 // NOTE: Try to use multithread if possible
@@ -16,6 +16,8 Q_DECLARE_LOGGING_CATEGORY(LOG_CosinusProvider)
16 16 */
17 17 class SCIQLOP_MOCKPLUGIN_EXPORT CosinusProvider : public IDataProvider {
18 18 public:
19 std::shared_ptr<IDataProvider> clone() const override;
20
19 21 /// @sa IDataProvider::requestDataLoading(). The current impl isn't thread safe.
20 22 void requestDataLoading(QUuid acqIdentifier, const DataProviderParameters &parameters) override;
21 23
@@ -11,6 +11,12
11 11
12 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 20 std::shared_ptr<IDataSeries> CosinusProvider::retrieveData(QUuid acqIdentifier,
15 21 const SqpRange &dataRangeRequested)
16 22 {
General Comments 0
You need to be logged in to leave comments. Login now