comparison data/fft/FFTDataServer.cpp @ 152:21792a550ec9 last-cc-copyright

* Move the current DenseThreeDimensionalModel to EditableDenseThreeDimensionalModel (wow!), and make DTDM an abstract base * Move FFTFuzzyAdapter to FFTModel as a new subclass of DTDM
author Chris Cannam
date Mon, 31 Jul 2006 17:05:18 +0000
parents 4b2ea82fd0ed
children 8d92611901d3
comparison
equal deleted inserted replaced
151:3c1d5ef43baa 152:21792a550ec9
110 // -- if we're asked for an instance with a given window type and 110 // -- if we're asked for an instance with a given window type and
111 // size and fft size and we have one already the same but with a 111 // size and fft size and we have one already the same but with a
112 // smaller increment, we can draw the results from it (provided 112 // smaller increment, we can draw the results from it (provided
113 // our increment is a multiple of its) 113 // our increment is a multiple of its)
114 // 114 //
115 // The FFTFuzzyAdapter knows how to interpret these things. In 115 // The FFTModel knows how to interpret these things. In
116 // both cases we require that the larger one is a power-of-two 116 // both cases we require that the larger one is a power-of-two
117 // multiple of the smaller (e.g. even though in principle you can 117 // multiple of the smaller (e.g. even though in principle you can
118 // draw the results at increment 256 from those at increment 768 118 // draw the results at increment 256 from those at increment 768
119 // or 1536, the fuzzy adapter doesn't support this). 119 // or 1536, the model doesn't support this).
120 120
121 { 121 {
122 QMutexLocker locker(&m_serverMapMutex); 122 QMutexLocker locker(&m_serverMapMutex);
123 123
124 ServerMap::iterator best = m_servers.end(); 124 ServerMap::iterator best = m_servers.end();
203 ++m_servers[n].second; 203 ++m_servers[n].second;
204 return m_servers[n].first; 204 return m_servers[n].first;
205 } 205 }
206 206
207 return 0; 207 return 0;
208 }
209
210 void
211 FFTDataServer::claimInstance(FFTDataServer *server)
212 {
213
214 QMutexLocker locker(&m_serverMapMutex);
215
216 for (ServerMap::iterator i = m_servers.begin(); i != m_servers.end(); ++i) {
217 if (i->second.first == server) {
218 ++i->second.second;
219 return;
220 }
221 }
222
223 std::cerr << "ERROR: FFTDataServer::claimInstance: instance "
224 << server << " unknown!" << std::endl;
208 } 225 }
209 226
210 void 227 void
211 FFTDataServer::releaseInstance(FFTDataServer *server) 228 FFTDataServer::releaseInstance(FFTDataServer *server)
212 { 229 {