Mercurial > hg > svcore
comparison data/model/Dense3DModelPeakCache.cpp @ 929:59e7fe1b1003 warnfix_no_size_t
Unsigned removals and warning fixes in data/
author | Chris Cannam |
---|---|
date | Tue, 17 Jun 2014 14:33:42 +0100 |
parents | bbe503e368a9 |
children | ece369c5bb68 |
comparison
equal
deleted
inserted
replaced
928:6a94bb528e9d | 929:59e7fe1b1003 |
---|---|
16 #include "Dense3DModelPeakCache.h" | 16 #include "Dense3DModelPeakCache.h" |
17 | 17 |
18 #include "base/Profiler.h" | 18 #include "base/Profiler.h" |
19 | 19 |
20 Dense3DModelPeakCache::Dense3DModelPeakCache(DenseThreeDimensionalModel *source, | 20 Dense3DModelPeakCache::Dense3DModelPeakCache(DenseThreeDimensionalModel *source, |
21 size_t columnsPerPeak) : | 21 int columnsPerPeak) : |
22 m_source(source), | 22 m_source(source), |
23 m_resolution(columnsPerPeak) | 23 m_resolution(columnsPerPeak) |
24 { | 24 { |
25 m_coverage.resize(1); // otherwise it is simply invalid | 25 m_coverage.resize(1); // otherwise it is simply invalid |
26 | 26 |
42 { | 42 { |
43 delete m_cache; | 43 delete m_cache; |
44 } | 44 } |
45 | 45 |
46 bool | 46 bool |
47 Dense3DModelPeakCache::isColumnAvailable(size_t column) const | 47 Dense3DModelPeakCache::isColumnAvailable(int column) const |
48 { | 48 { |
49 if (!m_source) return false; | 49 if (!m_source) return false; |
50 if (haveColumn(column)) return true; | 50 if (haveColumn(column)) return true; |
51 for (int i = m_resolution; i > 0; ) { | 51 for (int i = m_resolution; i > 0; ) { |
52 --i; | 52 --i; |
56 } | 56 } |
57 return true; | 57 return true; |
58 } | 58 } |
59 | 59 |
60 Dense3DModelPeakCache::Column | 60 Dense3DModelPeakCache::Column |
61 Dense3DModelPeakCache::getColumn(size_t column) const | 61 Dense3DModelPeakCache::getColumn(int column) const |
62 { | 62 { |
63 Profiler profiler("Dense3DModelPeakCache::getColumn"); | 63 Profiler profiler("Dense3DModelPeakCache::getColumn"); |
64 if (!m_source) return Column(); | 64 if (!m_source) return Column(); |
65 if (!haveColumn(column)) fillColumn(column); | 65 if (!haveColumn(column)) fillColumn(column); |
66 return m_cache->getColumn(column); | 66 return m_cache->getColumn(column); |
67 } | 67 } |
68 | 68 |
69 float | 69 float |
70 Dense3DModelPeakCache::getValueAt(size_t column, size_t n) const | 70 Dense3DModelPeakCache::getValueAt(int column, int n) const |
71 { | 71 { |
72 if (!m_source) return 0.f; | 72 if (!m_source) return 0.f; |
73 if (!haveColumn(column)) fillColumn(column); | 73 if (!haveColumn(column)) fillColumn(column); |
74 return m_cache->getValueAt(column, n); | 74 return m_cache->getValueAt(column, n); |
75 } | 75 } |
91 { | 91 { |
92 m_source = 0; | 92 m_source = 0; |
93 } | 93 } |
94 | 94 |
95 bool | 95 bool |
96 Dense3DModelPeakCache::haveColumn(size_t column) const | 96 Dense3DModelPeakCache::haveColumn(int column) const |
97 { | 97 { |
98 return column < m_coverage.size() && m_coverage.get(column); | 98 return column < (int)m_coverage.size() && m_coverage.get(column); |
99 } | 99 } |
100 | 100 |
101 void | 101 void |
102 Dense3DModelPeakCache::fillColumn(size_t column) const | 102 Dense3DModelPeakCache::fillColumn(int column) const |
103 { | 103 { |
104 Profiler profiler("Dense3DModelPeakCache::fillColumn"); | 104 Profiler profiler("Dense3DModelPeakCache::fillColumn"); |
105 | 105 |
106 if (column >= m_coverage.size()) { | 106 if (column >= (int)m_coverage.size()) { |
107 // see note in sourceModelChanged | 107 // see note in sourceModelChanged |
108 if (m_coverage.size() > 0) m_coverage.reset(m_coverage.size()-1); | 108 if (m_coverage.size() > 0) m_coverage.reset(m_coverage.size()-1); |
109 m_coverage.resize(column + 1); | 109 m_coverage.resize(column + 1); |
110 } | 110 } |
111 | 111 |
112 Column peak; | 112 Column peak; |
113 for (int i = 0; i < m_resolution; ++i) { | 113 for (int i = 0; i < int(m_resolution); ++i) { |
114 Column here = m_source->getColumn(column * m_resolution + i); | 114 Column here = m_source->getColumn(column * m_resolution + i); |
115 if (i == 0) { | 115 if (i == 0) { |
116 peak = here; | 116 peak = here; |
117 } else { | 117 } else { |
118 for (int j = 0; j < peak.size() && j < here.size(); ++j) { | 118 for (int j = 0; j < (int)peak.size() && j < (int)here.size(); ++j) { |
119 if (here[j] > peak[j]) peak[j] = here[j]; | 119 if (here[j] > peak[j]) peak[j] = here[j]; |
120 } | 120 } |
121 } | 121 } |
122 } | 122 } |
123 | 123 |