author | zecke <zecke> | 2002-10-19 00:08:35 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-19 00:08:35 (UTC) |
commit | 549472ef07703ef27dc5f58a37e8f16c714fb2a1 (patch) (side-by-side diff) | |
tree | 9742f2545ef3504e61a07cef2996aa29b9db5b90 | |
parent | 598cfa66b57d61e15bc3c5ea3a9c8e7295864455 (diff) | |
download | opie-549472ef07703ef27dc5f58a37e8f16c714fb2a1.zip opie-549472ef07703ef27dc5f58a37e8f16c714fb2a1.tar.gz opie-549472ef07703ef27dc5f58a37e8f16c714fb2a1.tar.bz2 |
Add void setReadAhead(uint) to the templates
OTodoAccessSQL use the read ahead value
-rw-r--r-- | libopie/pim/opimaccessbackend.h | 16 | ||||
-rw-r--r-- | libopie/pim/opimaccesstemplate.h | 5 | ||||
-rw-r--r-- | libopie/pim/otodoaccesssql.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiepim/backend/opimaccessbackend.h | 16 | ||||
-rw-r--r-- | libopie2/opiepim/backend/otodoaccesssql.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiepim/core/opimaccesstemplate.h | 5 |
6 files changed, 42 insertions, 4 deletions
diff --git a/libopie/pim/opimaccessbackend.h b/libopie/pim/opimaccessbackend.h index 27d3cb8..0bd2723 100644 --- a/libopie/pim/opimaccessbackend.h +++ b/libopie/pim/opimaccessbackend.h @@ -83,6 +83,10 @@ public: */ void setFrontend( Frontend* front ); + /** + * set the read ahead count + */ + void setReadAhead( uint count ); protected: void cache( const T& t )const; @@ -91,8 +95,11 @@ protected: */ void setSaneCacheSize( int ); + uint readAhead()const; + private: Frontend* m_front; + uint m_read; }; @@ -123,5 +130,12 @@ T OPimAccessBackend<T>::find( int uid, const QArray<int>&, uint, Frontend::CacheDirection )const { return find( uid ); } - +template <class T> +void OPimAccessBackend<T>::setReadAhead( uint count ) { + m_read = count; +} +template <class T> +uint OPimAccessBackend<T>::readAhead()const { + return m_read; +} #endif diff --git a/libopie/pim/opimaccesstemplate.h b/libopie/pim/opimaccesstemplate.h index 50cb1e4..c5523a8 100644 --- a/libopie/pim/opimaccesstemplate.h +++ b/libopie/pim/opimaccesstemplate.h @@ -116,6 +116,7 @@ public: */ virtual bool replace( const T& t) ; + void setReadAhead( uint count ); /** * @internal */ @@ -251,4 +252,8 @@ template <class T> void OPimAccessTemplate<T>::setSaneCacheSize( int size ) { m_cache.setSize( size ); } +template <class T> +void OPimAccessTemplate<T>::setReadAhead( uint count ) { + m_backEnd->setReadAhead( count ); +} #endif diff --git a/libopie/pim/otodoaccesssql.cpp b/libopie/pim/otodoaccesssql.cpp index 9ef6b7c..8c2ea3a 100644 --- a/libopie/pim/otodoaccesssql.cpp +++ b/libopie/pim/otodoaccesssql.cpp @@ -286,9 +286,9 @@ OTodo OTodoAccessBackendSQL::find(int uid ) const{ return todo( m_driver->query(&query) ); } -#define CACHE 32 OTodo OTodoAccessBackendSQL::find( int uid, const QArray<int>& ints, uint cur, Frontend::CacheDirection dir ) const{ + int CACHE = readAhead(); qWarning("searching for %d", uid ); QArray<int> search( CACHE ); uint size =0; diff --git a/libopie2/opiepim/backend/opimaccessbackend.h b/libopie2/opiepim/backend/opimaccessbackend.h index 27d3cb8..0bd2723 100644 --- a/libopie2/opiepim/backend/opimaccessbackend.h +++ b/libopie2/opiepim/backend/opimaccessbackend.h @@ -83,6 +83,10 @@ public: */ void setFrontend( Frontend* front ); + /** + * set the read ahead count + */ + void setReadAhead( uint count ); protected: void cache( const T& t )const; @@ -91,8 +95,11 @@ protected: */ void setSaneCacheSize( int ); + uint readAhead()const; + private: Frontend* m_front; + uint m_read; }; @@ -123,5 +130,12 @@ T OPimAccessBackend<T>::find( int uid, const QArray<int>&, uint, Frontend::CacheDirection )const { return find( uid ); } - +template <class T> +void OPimAccessBackend<T>::setReadAhead( uint count ) { + m_read = count; +} +template <class T> +uint OPimAccessBackend<T>::readAhead()const { + return m_read; +} #endif diff --git a/libopie2/opiepim/backend/otodoaccesssql.cpp b/libopie2/opiepim/backend/otodoaccesssql.cpp index 9ef6b7c..8c2ea3a 100644 --- a/libopie2/opiepim/backend/otodoaccesssql.cpp +++ b/libopie2/opiepim/backend/otodoaccesssql.cpp @@ -286,9 +286,9 @@ OTodo OTodoAccessBackendSQL::find(int uid ) const{ return todo( m_driver->query(&query) ); } -#define CACHE 32 OTodo OTodoAccessBackendSQL::find( int uid, const QArray<int>& ints, uint cur, Frontend::CacheDirection dir ) const{ + int CACHE = readAhead(); qWarning("searching for %d", uid ); QArray<int> search( CACHE ); uint size =0; diff --git a/libopie2/opiepim/core/opimaccesstemplate.h b/libopie2/opiepim/core/opimaccesstemplate.h index 50cb1e4..c5523a8 100644 --- a/libopie2/opiepim/core/opimaccesstemplate.h +++ b/libopie2/opiepim/core/opimaccesstemplate.h @@ -116,6 +116,7 @@ public: */ virtual bool replace( const T& t) ; + void setReadAhead( uint count ); /** * @internal */ @@ -251,4 +252,8 @@ template <class T> void OPimAccessTemplate<T>::setSaneCacheSize( int size ) { m_cache.setSize( size ); } +template <class T> +void OPimAccessTemplate<T>::setReadAhead( uint count ) { + m_backEnd->setReadAhead( count ); +} #endif |