19 #ifndef DLFIFOLIST_HPP
20 #define DLFIFOLIST_HPP
22 #include <ndb_global.h>
23 #include <kernel_types.h>
30 template <
typename P,
typename T,
typename U = T>
47 inline bool isEmpty()
const {
return firstItem == RNIL;}
54 bool seize(
Ptr<T> & ptr) {
return seizeLast(ptr);}
61 void add(
Ptr<T> & ptr) { addLast(ptr);}
128 inline bool isEmpty()
const {
return head.firstItem == RNIL;}
135 assert(&thePool == &src.thePool);
136 this->head = src.head;
145 template <
typename P,
typename T,
typename U = T>
154 assert(src.in_use ==
false);
161 assert(src.in_use ==
true);
169 template <
typename P,
typename T,
typename U>
176 template <
typename P,
typename T,
typename U>
182 ASSERT_TYPE_HAS_CONSTRUCTOR(T);
192 template <
typename P,
typename T,
typename U>
197 if (likely(thePool.seize(p)))
206 template <
typename P,
typename T,
typename U>
211 if (likely(thePool.seize(p)))
220 template <
typename P,
typename T,
typename U>
225 Uint32 ff = head.firstItem;
227 p.p->U::prevList = RNIL;
228 p.p->U::nextList = ff;
229 head.firstItem = p.i;
236 T * t2 = thePool.getPtr(ff);
237 t2->U::prevList = p.i;
241 template <
typename P,
typename T,
typename U>
247 Uint32
last = head.lastItem;
250 t->U::nextList = RNIL;
251 t->U::prevList =
last;
255 T * t2 = thePool.getPtr(last);
256 t2->U::nextList = p.i;
260 head.firstItem = p.i;
264 template <
typename P,
typename T,
typename U>
269 Uint32
prev= loc.p->U::prevList;
270 if(loc.i == head.firstItem)
272 head.firstItem = ptr.i;
273 assert(prev == RNIL);
277 T* t2 = thePool.getPtr(prev);
278 t2->U::nextList = ptr.i;
281 loc.p->U::prevList = ptr.i;
282 ptr.p->U::prevList =
prev;
283 ptr.p->U::nextList = loc.i;
286 template <
typename P,
typename T,
typename U>
291 head.firstItem = RNIL;
292 head.lastItem = RNIL;
295 template <
typename P,
typename T,
typename U>
303 template <
typename P,
typename T,
typename U>
308 Uint32 ni = t->U::nextList;
309 Uint32 pi = t->U::prevList;
313 T * t = thePool.getPtr(ni);
324 T * t = thePool.getPtr(pi);
334 template <
typename P,
typename T,
typename U>
340 Uint32 curr = head.firstItem;
343 thePool.getPtr(ptr, curr);
344 curr = ptr.p->U::nextList;
345 thePool.release(ptr);
347 head.firstItem = RNIL;
348 head.lastItem = RNIL;
351 template <
typename P,
typename T,
typename U>
360 template <
typename P,
typename T,
typename U>
366 p.p = thePool.getPtr(i);
369 template <
typename P,
typename T,
typename U>
377 template <
typename P,
typename T,
typename U>
382 return thePool.getPtr(i);
390 template <
typename P,
typename T,
typename U>
395 p.i = head.firstItem;
398 p.p = thePool.getPtr(p.i);
405 template <
typename P,
typename T,
typename U>
413 p.p = thePool.getPtr(p.i);
420 template <
typename P,
typename T,
typename U>
425 p.i = p.p->U::nextList;
428 p.p = thePool.getPtr(p.i);
435 template <
typename P,
typename T,
typename U>
440 p.i = p.p->U::prevList;
443 p.p = thePool.getPtr(p.i);
450 template <
typename P,
typename T,
typename U>
455 return p.p->U::nextList != RNIL;
458 template <
typename P,
typename T,
typename U>
463 return p.p->U::prevList != RNIL;
468 template <
typename T,
typename U = T>
475 template <
typename T,
typename U = T>