##// END OF EJS Templates
Adds QVariantHash to store metadata in a variable
Alexandre Leroux -
r406:643df4da22dc
parent child
Show More
@@ -22,7 +22,8 class Variable : public QObject {
22 22 Q_OBJECT
23 23
24 24 public:
25 explicit Variable(const QString &name, const SqpDateTime &dateTime);
25 explicit Variable(const QString &name, const SqpDateTime &dateTime,
26 const QVariantHash &metadata = {});
26 27
27 28 QString name() const noexcept;
28 29 SqpDateTime dateTime() const noexcept;
@@ -31,6 +32,8 public:
31 32 /// @return the data of the variable, nullptr if there is no data
32 33 IDataSeries *dataSeries() const noexcept;
33 34
35 QVariantHash metadata() const noexcept;
36
34 37 bool contains(const SqpDateTime &dateTime) const noexcept;
35 38 bool intersect(const SqpDateTime &dateTime) const noexcept;
36 39 bool isInside(const SqpDateTime &dateTime) const noexcept;
@@ -9,19 +9,21
9 9 Q_LOGGING_CATEGORY(LOG_Variable, "Variable")
10 10
11 11 struct Variable::VariablePrivate {
12 explicit VariablePrivate(const QString &name, const SqpDateTime &dateTime)
13 : m_Name{name}, m_DateTime{dateTime}, m_DataSeries{nullptr}
12 explicit VariablePrivate(const QString &name, const SqpDateTime &dateTime,
13 const QVariantHash &metadata)
14 : m_Name{name}, m_DateTime{dateTime}, m_Metadata{metadata}, m_DataSeries{nullptr}
14 15 {
15 16 }
16 17
17 18 QString m_Name;
18 19
19 20 SqpDateTime m_DateTime; // The dateTime available in the view and loaded. not the cache.
21 QVariantHash m_Metadata;
20 22 std::unique_ptr<IDataSeries> m_DataSeries;
21 23 };
22 24
23 Variable::Variable(const QString &name, const SqpDateTime &dateTime)
24 : impl{spimpl::make_unique_impl<VariablePrivate>(name, dateTime)}
25 Variable::Variable(const QString &name, const SqpDateTime &dateTime, const QVariantHash &metadata)
26 : impl{spimpl::make_unique_impl<VariablePrivate>(name, dateTime, metadata)}
25 27 {
26 28 }
27 29
@@ -67,6 +69,11 IDataSeries *Variable::dataSeries() const noexcept
67 69 return impl->m_DataSeries.get();
68 70 }
69 71
72 QVariantHash Variable::metadata() const noexcept
73 {
74 return impl->m_Metadata;
75 }
76
70 77 bool Variable::contains(const SqpDateTime &dateTime) const noexcept
71 78 {
72 79 return impl->m_DateTime.contains(dateTime);
General Comments 0
You need to be logged in to leave comments. Login now