author | eilers <eilers> | 2004-09-05 15:46:47 (UTC) |
---|---|---|
committer | eilers <eilers> | 2004-09-05 15:46:47 (UTC) |
commit | 97a40bb7f35a8323dd99712bf014387add283177 (patch) (unidiff) | |
tree | ec50fbb430f00c86af6ca5bd7c6b94fa29cfe3b1 /libopie2/opiepim/backend/opimaccessbackend.h | |
parent | f8b02e2ae752ce98b8840735260c4e9b0ff25cb8 (diff) | |
download | opie-97a40bb7f35a8323dd99712bf014387add283177.zip opie-97a40bb7f35a8323dd99712bf014387add283177.tar.gz opie-97a40bb7f35a8323dd99712bf014387add283177.tar.bz2 |
Fixing really stupid caching bug.. Thanks to zecke who found it..
Removed cachefind in backend which isn't needed anymore and not a goot idea...
Diffstat (limited to 'libopie2/opiepim/backend/opimaccessbackend.h') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiepim/backend/opimaccessbackend.h | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/libopie2/opiepim/backend/opimaccessbackend.h b/libopie2/opiepim/backend/opimaccessbackend.h index 15a7b7f..26af762 100644 --- a/libopie2/opiepim/backend/opimaccessbackend.h +++ b/libopie2/opiepim/backend/opimaccessbackend.h | |||
@@ -129,19 +129,12 @@ public: | |||
129 | protected: | 129 | protected: |
130 | int access()const; | 130 | int access()const; |
131 | 131 | ||
132 | void cache( const T& t )const; | 132 | void cache( const T& t )const; |
133 | 133 | ||
134 | /** | 134 | /** |
135 | * Returns the element with given uid out of the cache. | ||
136 | * Returns empty element if nothing was found. | ||
137 | * <b>Attention:</b> This just works if we have a frontend which contains the cache ! | ||
138 | */ | ||
139 | T cacheFind( int uid ) const; | ||
140 | |||
141 | /** | ||
142 | * use a prime number here! | 135 | * use a prime number here! |
143 | */ | 136 | */ |
144 | void setSaneCacheSize( int ); | 137 | void setSaneCacheSize( int ); |
145 | 138 | ||
146 | uint readAhead()const; | 139 | uint readAhead()const; |
147 | 140 | ||
@@ -170,31 +163,22 @@ void OPimAccessBackend<T>::setFrontend( Frontend* fr ) { | |||
170 | template <class T> | 163 | template <class T> |
171 | void OPimAccessBackend<T>::cache( const T& t )const { | 164 | void OPimAccessBackend<T>::cache( const T& t )const { |
172 | if ( m_front ) | 165 | if ( m_front ) |
173 | m_front->cache( t ); | 166 | m_front->cache( t ); |
174 | } | 167 | } |
175 | 168 | ||
176 | template <class T> | ||
177 | T OPimAccessBackend<T>::cacheFind( int uid )const { | ||
178 | if ( ! m_front ){ | ||
179 | qWarning ( "No frontend assigned ! Therefore we cannot access the cache to return the right element!" ); | ||
180 | return T(); | ||
181 | } | ||
182 | |||
183 | return m_front->cacheFind( uid ); | ||
184 | } | ||
185 | 169 | ||
186 | template <class T> | 170 | template <class T> |
187 | void OPimAccessBackend<T>::setSaneCacheSize( int size) { | 171 | void OPimAccessBackend<T>::setSaneCacheSize( int size) { |
188 | if ( m_front ) | 172 | if ( m_front ) |
189 | m_front->setSaneCacheSize( size ); | 173 | m_front->setSaneCacheSize( size ); |
190 | } | 174 | } |
191 | template <class T> | 175 | template <class T> |
192 | T OPimAccessBackend<T>::find( int uid, const QArray<int>&, | 176 | T OPimAccessBackend<T>::find( int uid, const QArray<int>&, |
193 | uint, typename Frontend::CacheDirection ) const{ | 177 | uint, typename Frontend::CacheDirection ) const{ |
194 | qDebug( "*** Lookahead feature not supported. Fallback to default find!" ); | 178 | qDebug( "*** Lookahead feature not supported. Fallback to default find!!" ); |
195 | return find( uid ); | 179 | return find( uid ); |
196 | } | 180 | } |
197 | template <class T> | 181 | template <class T> |
198 | void OPimAccessBackend<T>::setReadAhead( uint count ) { | 182 | void OPimAccessBackend<T>::setReadAhead( uint count ) { |
199 | m_read = count; | 183 | m_read = count; |
200 | } | 184 | } |