##// END OF EJS Templates
Generates vectors (3)...
Alexandre Leroux -
r784:595dafd656f6
parent child
Show More
@@ -50,6 +50,21 struct VectorCosinus : public ICosinusType {
50 }
50 }
51 };
51 };
52
52
53 /// Converts string to cosinus type
54 /// @return the cosinus type if the string could be converted, nullptr otherwise
55 std::unique_ptr<ICosinusType> cosinusType(const QString &type) noexcept
56 {
57 if (type.compare(QStringLiteral("scalar"), Qt::CaseInsensitive) == 0) {
58 return std::make_unique<ScalarCosinus>();
59 }
60 else if (type.compare(QStringLiteral("vector"), Qt::CaseInsensitive) == 0) {
61 return std::make_unique<VectorCosinus>();
62 }
63 else {
64 return nullptr;
65 }
66 }
67
53 } // namespace
68 } // namespace
54
69
55 std::shared_ptr<IDataProvider> CosinusProvider::clone() const
70 std::shared_ptr<IDataProvider> CosinusProvider::clone() const
@@ -65,6 +80,19 std::shared_ptr<IDataSeries> CosinusProvider::retrieveData(QUuid acqIdentifier,
65 // TODO: Add Mutex
80 // TODO: Add Mutex
66 auto dataIndex = 0;
81 auto dataIndex = 0;
67
82
83 // Retrieves cosinus type
84 auto typeVariant = data.value(COSINUS_TYPE_KEY, COSINUS_TYPE_DEFAULT_VALUE);
85 if (!typeVariant.canConvert<QString>()) {
86 qCCritical(LOG_CosinusProvider()) << tr("Can't retrieve data: invalid type");
87 return nullptr;
88 }
89
90 auto type = cosinusType(typeVariant.toString());
91 if (!type) {
92 qCCritical(LOG_CosinusProvider()) << tr("Can't retrieve data: unknown type");
93 return nullptr;
94 }
95
68 // Retrieves frequency
96 // Retrieves frequency
69 auto freqVariant = data.value(COSINUS_FREQUENCY_KEY, COSINUS_FREQUENCY_DEFAULT_VALUE);
97 auto freqVariant = data.value(COSINUS_FREQUENCY_KEY, COSINUS_FREQUENCY_DEFAULT_VALUE);
70 if (!freqVariant.canConvert<double>()) {
98 if (!freqVariant.canConvert<double>()) {
General Comments 0
You need to be logged in to leave comments. Login now