-rw-r--r-- | libopie2/opiepim/backend/obackendfactory.h | 20 | ||||
-rw-r--r-- | libopie2/opiepim/backend/opimaccessbackend.h | 40 |
2 files changed, 53 insertions, 7 deletions
diff --git a/libopie2/opiepim/backend/obackendfactory.h b/libopie2/opiepim/backend/obackendfactory.h index f11f029..89b8c58 100644 --- a/libopie2/opiepim/backend/obackendfactory.h +++ b/libopie2/opiepim/backend/obackendfactory.h @@ -18,2 +18,9 @@ * $Log$ + * Revision 1.3 2002/10/10 17:08:58 zecke + * The Cache is finally in place + * I tested it with my todolist and it 'works' for 10.000 todos the hits are awesome ;) + * The read ahead functionality does not make sense for XMLs backends because most of the stuff is already in memory. While using readahead on SQL makes things a lot faster.... + * I still have to fully implement read ahead + * This change is bic but sc + * * Revision 1.2 2002/10/08 09:27:36 eilers @@ -30,4 +37,4 @@ */ -#ifndef __OPIE_BACKENDFACTORY_H_ -#define __OPIE_BACKENDFACTORY_H_ +#ifndef OPIE_BACKENDFACTORY_H_ +#define OPIE_BACKENDFACTORY_H_ @@ -40,5 +47,6 @@ -#ifdef __USE_SQL +/*#ifdef __USE_SQL #include "otodoaccesssql.h" #endif +*/ @@ -74,9 +82,9 @@ class OBackendFactory case TODO: -#ifdef __USE_SQL +/*#ifdef __USE_SQL if ( backend == "sql" ) return (T*) new OTodoAccessBackendSQL(""); -#else +#else*/ if ( backend == "sql" ) qWarning ("OBackendFactory:: sql Backend not implemented! Using XML instead!"); -#endif +//#endif diff --git a/libopie2/opiepim/backend/opimaccessbackend.h b/libopie2/opiepim/backend/opimaccessbackend.h index c27acbb..27d3cb8 100644 --- a/libopie2/opiepim/backend/opimaccessbackend.h +++ b/libopie2/opiepim/backend/opimaccessbackend.h @@ -5,2 +5,3 @@ +#include <opie/otemplatebase.h> #include <opie/opimrecord.h> @@ -19,2 +20,3 @@ class OPimAccessBackend { public: + typedef OTemplateBase<T> Frontend; OPimAccessBackend(); @@ -56,2 +58,4 @@ public: + virtual T find(int uid, const QArray<int>& items, + uint current, Frontend::CacheDirection )const ; /** @@ -76,2 +80,17 @@ public: + /* + * setTheFrontEnd!!! + */ + void setFrontend( Frontend* front ); + +protected: + void cache( const T& t )const; + + /** + * use a prime number here! + */ + void setSaneCacheSize( int ); + +private: + Frontend* m_front; @@ -81,3 +100,3 @@ template <class T> OPimAccessBackend<T>::OPimAccessBackend() { - + m_front = 0l; } @@ -87,2 +106,21 @@ OPimAccessBackend<T>::~OPimAccessBackend() { } +template <class T> +void OPimAccessBackend<T>::setFrontend( Frontend* fr ) { + m_front = fr; +} +template <class T> +void OPimAccessBackend<T>::cache( const T& t )const { + if (m_front ) + m_front->cache( t ); +} +template <class T> +void OPimAccessBackend<T>::setSaneCacheSize( int size) { + if (m_front ) + m_front->setSaneCacheSize( size ); +} +template <class T> +T OPimAccessBackend<T>::find( int uid, const QArray<int>&, + uint, Frontend::CacheDirection )const { + return find( uid ); +} |