Mercurial > hg > svcore
comparison data/fft/FFTDataServer.h @ 383:94fc0591ea43 1.2-stable
* merge from trunk (1.2 ended up being tracked from trunk, but we may want
this branch for fixes later)
author | Chris Cannam |
---|---|
date | Wed, 27 Feb 2008 10:32:45 +0000 |
parents | aa8dbac62024 |
children | 115f60df1e4d |
comparison
equal
deleted
inserted
replaced
349:f39d33b0b265 | 383:94fc0591ea43 |
---|---|
133 size_t m_width; | 133 size_t m_width; |
134 size_t m_height; | 134 size_t m_height; |
135 size_t m_cacheWidth; | 135 size_t m_cacheWidth; |
136 size_t m_cacheWidthPower; | 136 size_t m_cacheWidthPower; |
137 size_t m_cacheWidthMask; | 137 size_t m_cacheWidthMask; |
138 bool m_memoryCache; | 138 |
139 bool m_compactCache; | 139 int m_lastUsedCache; |
140 FFTCache *getCache(size_t x, size_t &col) { | |
141 col = x & m_cacheWidthMask; | |
142 int c = x >> m_cacheWidthPower; | |
143 // The only use of m_lastUsedCache without a lock is to | |
144 // establish whether a cache has been created at all (they're | |
145 // created on demand, but not destroyed until the server is). | |
146 if (c == m_lastUsedCache) return m_caches[c]; | |
147 else return getCacheAux(c); | |
148 } | |
149 bool haveCache(size_t x) { | |
150 int c = x >> m_cacheWidthPower; | |
151 if (c == m_lastUsedCache) return true; | |
152 else return (m_caches[c] != 0); | |
153 } | |
140 | 154 |
141 typedef std::vector<FFTCache *> CacheVector; | 155 typedef std::vector<FFTCache *> CacheVector; |
142 CacheVector m_caches; | 156 CacheVector m_caches; |
143 | 157 |
144 typedef std::deque<int> IntQueue; | 158 typedef std::deque<int> IntQueue; |
145 IntQueue m_dormantCaches; | 159 IntQueue m_dormantCaches; |
146 | 160 |
147 int m_lastUsedCache; | 161 StorageAdviser::Criteria m_criteria; |
148 FFTCache *getCache(size_t x, size_t &col) { | 162 |
149 col = x % m_cacheWidth; | 163 void getStorageAdvice(size_t w, size_t h, bool &memory, bool &compact); |
150 int c = x / m_cacheWidth; | |
151 // The only use of m_lastUsedCache without a lock is to | |
152 // establish whether a cache has been created at all (they're | |
153 // created on demand, but not destroyed until the server is). | |
154 if (c == m_lastUsedCache) return m_caches[c]; | |
155 else return getCacheAux(c); | |
156 } | |
157 bool haveCache(size_t x) { | |
158 int c = x / m_cacheWidth; | |
159 if (c == m_lastUsedCache) return true; | |
160 else return (m_caches[c] != 0); | |
161 } | |
162 | 164 |
163 FFTCache *getCacheAux(size_t c); | 165 FFTCache *getCacheAux(size_t c); |
164 QMutex m_writeMutex; | 166 QMutex m_writeMutex; |
165 QWaitCondition m_condition; | 167 QWaitCondition m_condition; |
166 | 168 |