Mercurial > hg > svcore
diff data/model/SparseModel.h @ 935:f960d67ce842 tonioni
Merge from branch warnfix_no_size_t
author | Chris Cannam |
---|---|
date | Wed, 18 Jun 2014 13:42:01 +0100 |
parents | df82da55e86a |
children | 9f526ddc6165 |
line wrap: on
line diff
--- a/data/model/SparseModel.h Mon Jun 16 11:28:45 2014 +0100 +++ b/data/model/SparseModel.h Wed Jun 18 13:42:01 2014 +0100 @@ -43,14 +43,14 @@ public TabularModel { public: - SparseModel(size_t sampleRate, size_t resolution, + SparseModel(int sampleRate, int resolution, bool notifyOnAdd = true); virtual ~SparseModel() { } virtual bool isOK() const { return true; } - virtual size_t getStartFrame() const; - virtual size_t getEndFrame() const; - virtual size_t getSampleRate() const { return m_sampleRate; } + virtual int getStartFrame() const; + virtual int getEndFrame() const; + virtual int getSampleRate() const { return m_sampleRate; } virtual Model *clone() const; @@ -59,10 +59,10 @@ // then every point in this model will be at a multiple of 10 // sample frames and should be considered to cover a window ending // 10 sample frames later. - virtual size_t getResolution() const { + virtual int getResolution() const { return m_resolution ? m_resolution : 1; } - virtual void setResolution(size_t resolution); + virtual void setResolution(int resolution); typedef PointType Point; typedef std::multiset<PointType, @@ -78,7 +78,7 @@ /** * Get the total number of points in the model. */ - virtual size_t getPointCount() const; + virtual int getPointCount() const; /** * Get all points. @@ -157,7 +157,7 @@ return s; } - virtual QString toDelimitedDataString(QString delimiter, size_t f0, size_t f1) const + virtual QString toDelimitedDataStringSubset(QString delimiter, int f0, int f1) const { QString s; for (PointListConstIterator i = m_points.begin(); i != m_points.end(); ++i) { @@ -371,15 +371,15 @@ } protected: - size_t m_sampleRate; - size_t m_resolution; + int m_sampleRate; + int m_resolution; bool m_notifyOnAdd; long m_sinceLastNotifyMin; long m_sinceLastNotifyMax; bool m_hasTextLabels; PointList m_points; - size_t m_pointCount; + int m_pointCount; mutable QMutex m_mutex; int m_completion; @@ -407,7 +407,7 @@ if (m_rows.empty()) rebuildRowVector(); if (row < 0 || row + 1 > int(m_rows.size())) return m_points.end(); - size_t frame = m_rows[row]; + int frame = m_rows[row]; int indexAtFrame = 0; int ri = row; while (ri > 0 && m_rows[ri-1] == m_rows[row]) { --ri; ++indexAtFrame; } @@ -434,7 +434,7 @@ if (m_rows.empty()) rebuildRowVector(); if (row < 0 || row + 1 > int(m_rows.size())) return m_points.end(); - size_t frame = m_rows[row]; + int frame = m_rows[row]; int indexAtFrame = 0; int ri = row; while (ri > 0 && m_rows[ri-1] == m_rows[row]) { --ri; ++indexAtFrame; } @@ -465,8 +465,8 @@ template <typename PointType> -SparseModel<PointType>::SparseModel(size_t sampleRate, - size_t resolution, +SparseModel<PointType>::SparseModel(int sampleRate, + int resolution, bool notifyOnAdd) : m_sampleRate(sampleRate), m_resolution(resolution), @@ -480,11 +480,11 @@ } template <typename PointType> -size_t +int SparseModel<PointType>::getStartFrame() const { QMutexLocker locker(&m_mutex); - size_t f = 0; + int f = 0; if (!m_points.empty()) { f = m_points.begin()->frame; } @@ -492,11 +492,11 @@ } template <typename PointType> -size_t +int SparseModel<PointType>::getEndFrame() const { QMutexLocker locker(&m_mutex); - size_t f = 0; + int f = 0; if (!m_points.empty()) { PointListConstIterator i(m_points.end()); f = (--i)->frame; @@ -526,7 +526,7 @@ } template <typename PointType> -size_t +int SparseModel<PointType>::getPointCount() const { return m_pointCount; @@ -676,7 +676,7 @@ template <typename PointType> void -SparseModel<PointType>::setResolution(size_t resolution) +SparseModel<PointType>::setResolution(int resolution) { { QMutexLocker locker(&m_mutex); @@ -718,7 +718,7 @@ if (m_notifyOnAdd) { m_rows.clear(); //!!! inefficient - emit modelChanged(point.frame, point.frame + m_resolution); + emit modelChangedWithin(point.frame, point.frame + m_resolution); } else { if (m_sinceLastNotifyMin == -1 || point.frame < m_sinceLastNotifyMin) { @@ -753,7 +753,7 @@ // std::cout << "SparseOneDimensionalModel: emit modelChanged(" // << point.frame << ")" << std::endl; m_rows.clear(); //!!! inefficient - emit modelChanged(point.frame, point.frame + m_resolution); + emit modelChangedWithin(point.frame, point.frame + m_resolution); } template <typename PointType> @@ -781,7 +781,7 @@ m_sinceLastNotifyMin >= 0 && m_sinceLastNotifyMax >= 0) { m_rows.clear(); //!!! inefficient - emit modelChanged(m_sinceLastNotifyMin, m_sinceLastNotifyMax); + emit modelChangedWithin(m_sinceLastNotifyMin, m_sinceLastNotifyMax); m_sinceLastNotifyMin = m_sinceLastNotifyMax = -1; } else { emit completionChanged();