author | zecke <zecke> | 2004-05-21 00:59:53 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-05-21 00:59:53 (UTC) |
commit | e20a6a2d3be99bdeaf3861f3aed7923e04b7ba04 (patch) (unidiff) | |
tree | 11c8ea83e4a409ca3ea931ac0315f2f2413ac8d8 | |
parent | cc30786a9fa612bb6ad0d19d6564f7e432267f7a (diff) | |
download | opie-e20a6a2d3be99bdeaf3861f3aed7923e04b7ba04.zip opie-e20a6a2d3be99bdeaf3861f3aed7923e04b7ba04.tar.gz opie-e20a6a2d3be99bdeaf3861f3aed7923e04b7ba04.tar.bz2 |
Fix comment
s/plugins/template
-rw-r--r-- | libopie2/opiepim/core/opimaccesstemplate.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/libopie2/opiepim/core/opimaccesstemplate.h b/libopie2/opiepim/core/opimaccesstemplate.h index d4c5fbb..e438980 100644 --- a/libopie2/opiepim/core/opimaccesstemplate.h +++ b/libopie2/opiepim/core/opimaccesstemplate.h | |||
@@ -1,357 +1,357 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) Holger Freyther <zecke@handhelds.org> | 3 | Copyright (C) Holger Freyther <zecke@handhelds.org> |
4 | Copyright (C) Stefan Eilers <eilers.stefan@epost.de> | 4 | Copyright (C) Stefan Eilers <eilers.stefan@epost.de> |
5 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | 5 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | */ | 29 | */ |
30 | #ifndef OPIE_PIM_ACCESS_TEMPLATE_H | 30 | #ifndef OPIE_PIM_ACCESS_TEMPLATE_H |
31 | #define OPIE_PIM_ACCESS_TEMPLATE_H | 31 | #define OPIE_PIM_ACCESS_TEMPLATE_H |
32 | 32 | ||
33 | #include <qarray.h> | 33 | #include <qarray.h> |
34 | 34 | ||
35 | #include <opie2/opimrecord.h> | 35 | #include <opie2/opimrecord.h> |
36 | #include <opie2/opimaccessbackend.h> | 36 | #include <opie2/opimaccessbackend.h> |
37 | #include <opie2/opimrecordlist.h> | 37 | #include <opie2/opimrecordlist.h> |
38 | 38 | ||
39 | #include <opie2/opimcache.h> | 39 | #include <opie2/opimcache.h> |
40 | #include <opie2/opimtemplatebase.h> | 40 | #include <opie2/opimtemplatebase.h> |
41 | 41 | ||
42 | namespace Opie { | 42 | namespace Opie { |
43 | 43 | ||
44 | class OPimAccessTemplatePrivate; | 44 | class OPimAccessTemplatePrivate; |
45 | /** | 45 | /** |
46 | * Thats the frontend to our OPIE PIM | 46 | * Thats the frontend to our OPIE PIM |
47 | * Library. Either you want to use it's | 47 | * Library. Either you want to use it's |
48 | * interface or you want to implement | 48 | * interface or you want to implement |
49 | * your own Access lib | 49 | * your own Access lib |
50 | * Just create a OPimRecord and inherit from | 50 | * Just create a OPimRecord and inherit from |
51 | * the plugins | 51 | * the templates |
52 | */ | 52 | */ |
53 | 53 | ||
54 | template <class T = OPimRecord > | 54 | template <class T = OPimRecord > |
55 | class OPimAccessTemplate : public OTemplateBase<T> { | 55 | class OPimAccessTemplate : public OTemplateBase<T> { |
56 | public: | 56 | public: |
57 | enum Access { | 57 | enum Access { |
58 | Random = 0, | 58 | Random = 0, |
59 | SortedAccess | 59 | SortedAccess |
60 | }; | 60 | }; |
61 | typedef OPimRecordList<T> List; | 61 | typedef OPimRecordList<T> List; |
62 | typedef OPimAccessBackend<T> BackEnd; | 62 | typedef OPimAccessBackend<T> BackEnd; |
63 | typedef OPimCache<T> Cache; | 63 | typedef OPimCache<T> Cache; |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * c'tor BackEnd | 66 | * c'tor BackEnd |
67 | * enum Access a small hint on how to handle the backend | 67 | * enum Access a small hint on how to handle the backend |
68 | */ | 68 | */ |
69 | OPimAccessTemplate( BackEnd* end); | 69 | OPimAccessTemplate( BackEnd* end); |
70 | 70 | ||
71 | virtual ~OPimAccessTemplate(); | 71 | virtual ~OPimAccessTemplate(); |
72 | 72 | ||
73 | /** | 73 | /** |
74 | * load from the backend | 74 | * load from the backend |
75 | */ | 75 | */ |
76 | bool load(); | 76 | bool load(); |
77 | 77 | ||
78 | /** Reload database. | 78 | /** Reload database. |
79 | * You should execute this function if the external database | 79 | * You should execute this function if the external database |
80 | * was changed. | 80 | * was changed. |
81 | * This function will load the external database and afterwards | 81 | * This function will load the external database and afterwards |
82 | * rejoin the local changes. Therefore the local database will be set consistent. | 82 | * rejoin the local changes. Therefore the local database will be set consistent. |
83 | */ | 83 | */ |
84 | virtual bool reload(); | 84 | virtual bool reload(); |
85 | 85 | ||
86 | /** Save contacts database. | 86 | /** Save contacts database. |
87 | * Save is more a "commit". After calling this function, all changes are public available. | 87 | * Save is more a "commit". After calling this function, all changes are public available. |
88 | * @return true if successful | 88 | * @return true if successful |
89 | */ | 89 | */ |
90 | bool save(); | 90 | bool save(); |
91 | 91 | ||
92 | /** | 92 | /** |
93 | * if the resource was changed externally | 93 | * if the resource was changed externally |
94 | * You should use the signal handling instead of polling possible changes ! | 94 | * You should use the signal handling instead of polling possible changes ! |
95 | * zecke: Do you implement a signal for otodoaccess ? | 95 | * zecke: Do you implement a signal for otodoaccess ? |
96 | */ | 96 | */ |
97 | bool wasChangedExternally()const; | 97 | bool wasChangedExternally()const; |
98 | 98 | ||
99 | /** | 99 | /** |
100 | * return a List of records | 100 | * return a List of records |
101 | * you can iterate over them | 101 | * you can iterate over them |
102 | */ | 102 | */ |
103 | virtual List allRecords()const; | 103 | virtual List allRecords()const; |
104 | 104 | ||
105 | /** | 105 | /** |
106 | * return a List of records | 106 | * return a List of records |
107 | * that match the regex | 107 | * that match the regex |
108 | */ | 108 | */ |
109 | virtual List matchRegexp( const QRegExp &r ) const; | 109 | virtual List matchRegexp( const QRegExp &r ) const; |
110 | 110 | ||
111 | /** | 111 | /** |
112 | * queryByExample. | 112 | * queryByExample. |
113 | * @see otodoaccess, ocontactaccess | 113 | * @see otodoaccess, ocontactaccess |
114 | */ | 114 | */ |
115 | virtual List queryByExample( const T& t, int querySettings, const QDateTime& d = QDateTime() ); | 115 | virtual List queryByExample( const T& t, int querySettings, const QDateTime& d = QDateTime() ); |
116 | 116 | ||
117 | /** | 117 | /** |
118 | * find the OPimRecord uid | 118 | * find the OPimRecord uid |
119 | */ | 119 | */ |
120 | virtual T find( int uid )const; | 120 | virtual T find( int uid )const; |
121 | 121 | ||
122 | /** | 122 | /** |
123 | * read ahead cache find method ;) | 123 | * read ahead cache find method ;) |
124 | */ | 124 | */ |
125 | virtual T find( int uid, const QArray<int>&, | 125 | virtual T find( int uid, const QArray<int>&, |
126 | uint current, typename OTemplateBase<T>::CacheDirection dir = OTemplateBase<T>::Forward )const; | 126 | uint current, typename OTemplateBase<T>::CacheDirection dir = OTemplateBase<T>::Forward )const; |
127 | 127 | ||
128 | /* invalidate cache here */ | 128 | /* invalidate cache here */ |
129 | /** | 129 | /** |
130 | * clears the backend and invalidates the backend | 130 | * clears the backend and invalidates the backend |
131 | */ | 131 | */ |
132 | void clear() ; | 132 | void clear() ; |
133 | 133 | ||
134 | /** | 134 | /** |
135 | * add T to the backend | 135 | * add T to the backend |
136 | * @param t The item to add. | 136 | * @param t The item to add. |
137 | * @return <i>true</i> if added successfully. | 137 | * @return <i>true</i> if added successfully. |
138 | */ | 138 | */ |
139 | virtual bool add( const T& t ) ; | 139 | virtual bool add( const T& t ) ; |
140 | bool add( const OPimRecord& ); | 140 | bool add( const OPimRecord& ); |
141 | // Needed for real generic access (eilers) | 141 | // Needed for real generic access (eilers) |
142 | // Info: Take this if you are working with OPimRecord, which is a generic base class, and | 142 | // Info: Take this if you are working with OPimRecord, which is a generic base class, and |
143 | // you need to add it into any database, you cannot generate a reference to | 143 | // you need to add it into any database, you cannot generate a reference to |
144 | // it and casting may be not approriate, too. | 144 | // it and casting may be not approriate, too. |
145 | // But take care that the accessing database is compatible to the real type of OPimRecord !! | 145 | // But take care that the accessing database is compatible to the real type of OPimRecord !! |
146 | bool add( const OPimRecord* ); | 146 | bool add( const OPimRecord* ); |
147 | 147 | ||
148 | 148 | ||
149 | /* only the uid matters */ | 149 | /* only the uid matters */ |
150 | /** | 150 | /** |
151 | * remove T from the backend | 151 | * remove T from the backend |
152 | * @param t The item to remove | 152 | * @param t The item to remove |
153 | * @return <i>true</i> if successful. | 153 | * @return <i>true</i> if successful. |
154 | */ | 154 | */ |
155 | virtual bool remove( const T& t ); | 155 | virtual bool remove( const T& t ); |
156 | 156 | ||
157 | /** | 157 | /** |
158 | * remove the OPimRecord with uid | 158 | * remove the OPimRecord with uid |
159 | * @param uid The ID of the item to remove | 159 | * @param uid The ID of the item to remove |
160 | * @return <i>true</i> if successful. | 160 | * @return <i>true</i> if successful. |
161 | */ | 161 | */ |
162 | bool remove( int uid ); | 162 | bool remove( int uid ); |
163 | bool remove( const OPimRecord& ); | 163 | bool remove( const OPimRecord& ); |
164 | 164 | ||
165 | /** | 165 | /** |
166 | * replace T from backend | 166 | * replace T from backend |
167 | * @param t The item to replace | 167 | * @param t The item to replace |
168 | * @return <i>true</i> if successful. | 168 | * @return <i>true</i> if successful. |
169 | */ | 169 | */ |
170 | virtual bool replace( const T& t) ; | 170 | virtual bool replace( const T& t) ; |
171 | 171 | ||
172 | void setReadAhead( uint count ); | 172 | void setReadAhead( uint count ); |
173 | /** | 173 | /** |
174 | * @internal | 174 | * @internal |
175 | */ | 175 | */ |
176 | void cache( const T& )const; | 176 | void cache( const T& )const; |
177 | void setSaneCacheSize( int ); | 177 | void setSaneCacheSize( int ); |
178 | 178 | ||
179 | QArray<int> records()const; | 179 | QArray<int> records()const; |
180 | protected: | 180 | protected: |
181 | /** | 181 | /** |
182 | * invalidate the cache | 182 | * invalidate the cache |
183 | */ | 183 | */ |
184 | void invalidateCache(); | 184 | void invalidateCache(); |
185 | 185 | ||
186 | void setBackEnd( BackEnd* end ); | 186 | void setBackEnd( BackEnd* end ); |
187 | /** | 187 | /** |
188 | * returns the backend | 188 | * returns the backend |
189 | */ | 189 | */ |
190 | BackEnd* backEnd(); | 190 | BackEnd* backEnd(); |
191 | BackEnd* m_backEnd; | 191 | BackEnd* m_backEnd; |
192 | Cache m_cache; | 192 | Cache m_cache; |
193 | 193 | ||
194 | private: | 194 | private: |
195 | OPimAccessTemplatePrivate *d; | 195 | OPimAccessTemplatePrivate *d; |
196 | 196 | ||
197 | }; | 197 | }; |
198 | 198 | ||
199 | template <class T> | 199 | template <class T> |
200 | OPimAccessTemplate<T>::OPimAccessTemplate( BackEnd* end ) | 200 | OPimAccessTemplate<T>::OPimAccessTemplate( BackEnd* end ) |
201 | : OTemplateBase<T>(), m_backEnd( end ) | 201 | : OTemplateBase<T>(), m_backEnd( end ) |
202 | { | 202 | { |
203 | if (end ) | 203 | if (end ) |
204 | end->setFrontend( this ); | 204 | end->setFrontend( this ); |
205 | } | 205 | } |
206 | template <class T> | 206 | template <class T> |
207 | OPimAccessTemplate<T>::~OPimAccessTemplate() { | 207 | OPimAccessTemplate<T>::~OPimAccessTemplate() { |
208 | qWarning("~OPimAccessTemplate<T>"); | 208 | qWarning("~OPimAccessTemplate<T>"); |
209 | delete m_backEnd; | 209 | delete m_backEnd; |
210 | } | 210 | } |
211 | template <class T> | 211 | template <class T> |
212 | bool OPimAccessTemplate<T>::load() { | 212 | bool OPimAccessTemplate<T>::load() { |
213 | invalidateCache(); | 213 | invalidateCache(); |
214 | return m_backEnd->load(); | 214 | return m_backEnd->load(); |
215 | } | 215 | } |
216 | template <class T> | 216 | template <class T> |
217 | bool OPimAccessTemplate<T>::reload() { | 217 | bool OPimAccessTemplate<T>::reload() { |
218 | invalidateCache(); // zecke: I think this should be added (se) | 218 | invalidateCache(); // zecke: I think this should be added (se) |
219 | return m_backEnd->reload(); | 219 | return m_backEnd->reload(); |
220 | } | 220 | } |
221 | template <class T> | 221 | template <class T> |
222 | bool OPimAccessTemplate<T>::save() { | 222 | bool OPimAccessTemplate<T>::save() { |
223 | return m_backEnd->save(); | 223 | return m_backEnd->save(); |
224 | } | 224 | } |
225 | template <class T> | 225 | template <class T> |
226 | typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::allRecords()const { | 226 | typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::allRecords()const { |
227 | QArray<int> ints = m_backEnd->allRecords(); | 227 | QArray<int> ints = m_backEnd->allRecords(); |
228 | List lis(ints, this ); | 228 | List lis(ints, this ); |
229 | return lis; | 229 | return lis; |
230 | } | 230 | } |
231 | template <class T> | 231 | template <class T> |
232 | typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::matchRegexp( const QRegExp &r )const { | 232 | typename OPimAccessTemplate<T>::List OPimAccessTemplate<T>::matchRegexp( const QRegExp &r )const { |
233 | QArray<int> ints = m_backEnd->matchRegexp( r ); | 233 | QArray<int> ints = m_backEnd->matchRegexp( r ); |
234 | List lis(ints, this ); | 234 | List lis(ints, this ); |
235 | return lis; | 235 | return lis; |
236 | } | 236 | } |
237 | template <class T> | 237 | template <class T> |
238 | QArray<int> OPimAccessTemplate<T>::records()const { | 238 | QArray<int> OPimAccessTemplate<T>::records()const { |
239 | return m_backEnd->allRecords(); | 239 | return m_backEnd->allRecords(); |
240 | } | 240 | } |
241 | template <class T> | 241 | template <class T> |
242 | typename OPimAccessTemplate<T>::List | 242 | typename OPimAccessTemplate<T>::List |
243 | OPimAccessTemplate<T>::queryByExample( const T& t, int settings, const QDateTime& d ) { | 243 | OPimAccessTemplate<T>::queryByExample( const T& t, int settings, const QDateTime& d ) { |
244 | QArray<int> ints = m_backEnd->queryByExample( t, settings, d ); | 244 | QArray<int> ints = m_backEnd->queryByExample( t, settings, d ); |
245 | 245 | ||
246 | List lis(ints, this ); | 246 | List lis(ints, this ); |
247 | return lis; | 247 | return lis; |
248 | } | 248 | } |
249 | template <class T> | 249 | template <class T> |
250 | T OPimAccessTemplate<T>::find( int uid ) const{ | 250 | T OPimAccessTemplate<T>::find( int uid ) const{ |
251 | T t = m_backEnd->find( uid ); | 251 | T t = m_backEnd->find( uid ); |
252 | cache( t ); | 252 | cache( t ); |
253 | return t; | 253 | return t; |
254 | } | 254 | } |
255 | template <class T> | 255 | template <class T> |
256 | T OPimAccessTemplate<T>::find( int uid, const QArray<int>& ar, | 256 | T OPimAccessTemplate<T>::find( int uid, const QArray<int>& ar, |
257 | uint current, typename OTemplateBase<T>::CacheDirection dir )const { | 257 | uint current, typename OTemplateBase<T>::CacheDirection dir )const { |
258 | /* | 258 | /* |
259 | * better do T.isEmpty() | 259 | * better do T.isEmpty() |
260 | * after a find this way we would | 260 | * after a find this way we would |
261 | * avoid two finds in QCache... | 261 | * avoid two finds in QCache... |
262 | */ | 262 | */ |
263 | // qWarning("find it now %d", uid ); | 263 | // qWarning("find it now %d", uid ); |
264 | if (m_cache.contains( uid ) ) { | 264 | if (m_cache.contains( uid ) ) { |
265 | return m_cache.find( uid ); | 265 | return m_cache.find( uid ); |
266 | } | 266 | } |
267 | 267 | ||
268 | T t = m_backEnd->find( uid, ar, current, dir ); | 268 | T t = m_backEnd->find( uid, ar, current, dir ); |
269 | cache( t ); | 269 | cache( t ); |
270 | return t; | 270 | return t; |
271 | } | 271 | } |
272 | template <class T> | 272 | template <class T> |
273 | void OPimAccessTemplate<T>::clear() { | 273 | void OPimAccessTemplate<T>::clear() { |
274 | invalidateCache(); | 274 | invalidateCache(); |
275 | m_backEnd->clear(); | 275 | m_backEnd->clear(); |
276 | } | 276 | } |
277 | template <class T> | 277 | template <class T> |
278 | bool OPimAccessTemplate<T>::add( const T& t ) { | 278 | bool OPimAccessTemplate<T>::add( const T& t ) { |
279 | cache( t ); | 279 | cache( t ); |
280 | return m_backEnd->add( t ); | 280 | return m_backEnd->add( t ); |
281 | } | 281 | } |
282 | 282 | ||
283 | template <class T> | 283 | template <class T> |
284 | bool OPimAccessTemplate<T>::add( const OPimRecord& rec) { | 284 | bool OPimAccessTemplate<T>::add( const OPimRecord& rec) { |
285 | /* same type */ | 285 | /* same type */ |
286 | T tempInstance; | 286 | T tempInstance; |
287 | if ( rec.rtti() == tempInstance.rtti() ) { | 287 | if ( rec.rtti() == tempInstance.rtti() ) { |
288 | const T& t = static_cast<const T&>(rec); | 288 | const T& t = static_cast<const T&>(rec); |
289 | return add(t); | 289 | return add(t); |
290 | } | 290 | } |
291 | return false; | 291 | return false; |
292 | } | 292 | } |
293 | 293 | ||
294 | template <class T> | 294 | template <class T> |
295 | bool OPimAccessTemplate<T>::add( const OPimRecord* rec) { | 295 | bool OPimAccessTemplate<T>::add( const OPimRecord* rec) { |
296 | /* same type, but pointer */ | 296 | /* same type, but pointer */ |
297 | T tempInstance; | 297 | T tempInstance; |
298 | if ( rec -> rtti() == tempInstance.rtti() ) { | 298 | if ( rec -> rtti() == tempInstance.rtti() ) { |
299 | const T* t = static_cast<const T*>(rec); | 299 | const T* t = static_cast<const T*>(rec); |
300 | return add( *t ); | 300 | return add( *t ); |
301 | } | 301 | } |
302 | return false; | 302 | return false; |
303 | } | 303 | } |
304 | 304 | ||
305 | template <class T> | 305 | template <class T> |
306 | bool OPimAccessTemplate<T>::remove( const T& t ) { | 306 | bool OPimAccessTemplate<T>::remove( const T& t ) { |
307 | return remove( t.uid() ); | 307 | return remove( t.uid() ); |
308 | } | 308 | } |
309 | template <class T> | 309 | template <class T> |
310 | bool OPimAccessTemplate<T>::remove( int uid ) { | 310 | bool OPimAccessTemplate<T>::remove( int uid ) { |
311 | m_cache.remove( uid ); | 311 | m_cache.remove( uid ); |
312 | return m_backEnd->remove( uid ); | 312 | return m_backEnd->remove( uid ); |
313 | } | 313 | } |
314 | template <class T> | 314 | template <class T> |
315 | bool OPimAccessTemplate<T>::remove( const OPimRecord& rec) { | 315 | bool OPimAccessTemplate<T>::remove( const OPimRecord& rec) { |
316 | return remove( rec.uid() ); | 316 | return remove( rec.uid() ); |
317 | } | 317 | } |
318 | template <class T> | 318 | template <class T> |
319 | bool OPimAccessTemplate<T>::replace( const T& t ) { | 319 | bool OPimAccessTemplate<T>::replace( const T& t ) { |
320 | m_cache.replace( t ); | 320 | m_cache.replace( t ); |
321 | return m_backEnd->replace( t ); | 321 | return m_backEnd->replace( t ); |
322 | } | 322 | } |
323 | template <class T> | 323 | template <class T> |
324 | void OPimAccessTemplate<T>::invalidateCache() { | 324 | void OPimAccessTemplate<T>::invalidateCache() { |
325 | m_cache.invalidate(); | 325 | m_cache.invalidate(); |
326 | } | 326 | } |
327 | template <class T> | 327 | template <class T> |
328 | typename OPimAccessTemplate<T>::BackEnd* OPimAccessTemplate<T>::backEnd() { | 328 | typename OPimAccessTemplate<T>::BackEnd* OPimAccessTemplate<T>::backEnd() { |
329 | return m_backEnd; | 329 | return m_backEnd; |
330 | } | 330 | } |
331 | template <class T> | 331 | template <class T> |
332 | bool OPimAccessTemplate<T>::wasChangedExternally()const { | 332 | bool OPimAccessTemplate<T>::wasChangedExternally()const { |
333 | return false; | 333 | return false; |
334 | } | 334 | } |
335 | template <class T> | 335 | template <class T> |
336 | void OPimAccessTemplate<T>::setBackEnd( BackEnd* end ) { | 336 | void OPimAccessTemplate<T>::setBackEnd( BackEnd* end ) { |
337 | m_backEnd = end; | 337 | m_backEnd = end; |
338 | if (m_backEnd ) | 338 | if (m_backEnd ) |
339 | m_backEnd->setFrontend( this ); | 339 | m_backEnd->setFrontend( this ); |
340 | } | 340 | } |
341 | template <class T> | 341 | template <class T> |
342 | void OPimAccessTemplate<T>::cache( const T& t ) const{ | 342 | void OPimAccessTemplate<T>::cache( const T& t ) const{ |
343 | /* hacky we need to work around the const*/ | 343 | /* hacky we need to work around the const*/ |
344 | ((OPimAccessTemplate<T>*)this)->m_cache.add( t ); | 344 | ((OPimAccessTemplate<T>*)this)->m_cache.add( t ); |
345 | } | 345 | } |
346 | template <class T> | 346 | template <class T> |
347 | void OPimAccessTemplate<T>::setSaneCacheSize( int size ) { | 347 | void OPimAccessTemplate<T>::setSaneCacheSize( int size ) { |
348 | m_cache.setSize( size ); | 348 | m_cache.setSize( size ); |
349 | } | 349 | } |
350 | template <class T> | 350 | template <class T> |
351 | void OPimAccessTemplate<T>::setReadAhead( uint count ) { | 351 | void OPimAccessTemplate<T>::setReadAhead( uint count ) { |
352 | m_backEnd->setReadAhead( count ); | 352 | m_backEnd->setReadAhead( count ); |
353 | } | 353 | } |
354 | 354 | ||
355 | } | 355 | } |
356 | 356 | ||
357 | #endif | 357 | #endif |