##// END OF EJS Templates
Review fixes
Alexandre Leroux -
r372:c0501a972eb4
parent child
Show More
@@ -23,18 +23,15 public:
23 23 template <int D = Dim, typename = std::enable_if_t<D == 1> >
24 24 explicit ArrayData(int nbColumns) : m_Data{1, QVector<double>{}}
25 25 {
26 QWriteLocker locker(&m_Lock);
26 QWriteLocker locker{&m_Lock};
27 27 m_Data[0].resize(nbColumns);
28 28 }
29 29
30 /**
31 * Ctor for a unidimensional ArrayData
32 * @param nbColumns the number of values the ArrayData will hold
33 */
30 /// Copy ctor
34 31 explicit ArrayData(const ArrayData &other)
35 32 {
36 QReadLocker otherLocker(&other.m_Lock);
37 QWriteLocker locker(&m_Lock);
33 QReadLocker otherLocker{&other.m_Lock};
34 QWriteLocker locker{&m_Lock};
38 35 m_Data = other.m_Data;
39 36 }
40 37
@@ -47,7 +44,7 public:
47 44 template <int D = Dim, typename = std::enable_if_t<D == 1> >
48 45 void setData(int index, double data) noexcept
49 46 {
50 QWriteLocker locker(&m_Lock);
47 QWriteLocker locker{&m_Lock};
51 48 if (index >= 0 && index < m_Data.at(0).size()) {
52 49 m_Data[0].replace(index, data);
53 50 }
@@ -60,7 +57,7 public:
60 57 template <int D = Dim, typename = std::enable_if_t<D == 1> >
61 58 QVector<double> data() const noexcept
62 59 {
63 QReadLocker locker(&m_Lock);
60 QReadLocker locker{&m_Lock};
64 61 return m_Data[0];
65 62 }
66 63
@@ -71,7 +68,7 public:
71 68 template <int D = Dim, typename = std::enable_if_t<D == 1> >
72 69 QVector<double> data(double tStart, double tEnd) const noexcept
73 70 {
74 QReadLocker locker(&m_Lock);
71 QReadLocker locker{&m_Lock};
75 72 return m_Data.at(tStart);
76 73 }
77 74
@@ -79,9 +76,9 public:
79 76 template <int D = Dim, typename = std::enable_if_t<D == 1> >
80 77 void merge(const ArrayData<1> &arrayData)
81 78 {
82 QWriteLocker locker(&m_Lock);
79 QWriteLocker locker{&m_Lock};
83 80 if (!m_Data.empty()) {
84 QReadLocker otherLocker(&arrayData.m_Lock);
81 QReadLocker otherLocker{&arrayData.m_Lock};
85 82 m_Data[0] += arrayData.data();
86 83 }
87 84 }
@@ -89,13 +86,13 public:
89 86 template <int D = Dim, typename = std::enable_if_t<D == 1> >
90 87 int size() const
91 88 {
92 QReadLocker locker(&m_Lock);
89 QReadLocker locker{&m_Lock};
93 90 return m_Data[0].size();
94 91 }
95 92
96 93 void clear()
97 94 {
98 QWriteLocker locker(&m_Lock);
95 QWriteLocker locker{&m_Lock};
99 96 m_Data.clear();
100 97 }
101 98
@@ -190,6 +190,8 void VariableModel::onVariableUpdated() noexcept
190 190 });
191 191
192 192 if (it != end) {
193 // Gets the index of the variable in the model: we assume here that views have the same
194 // order as the model
193 195 auto updateVariableIndex = std::distance(begin, it);
194 196 emit dataChanged(createIndex(updateVariableIndex, 0),
195 197 createIndex(updateVariableIndex, columnCount() - 1));
General Comments 0
You need to be logged in to leave comments. Login now