19 #if !defined(XALANLIST_HEADER_GUARD_1357924680)
20 #define XALANLIST_HEADER_GUARD_1357924680
46 template <
class Value>
54 template <
class Value>
62 template<
class XalanListTraits,
class Node>
66 typedef typename XalanListTraits::reference
reference;
67 typedef typename XalanListTraits::pointer
pointer;
81 currentNode(theRhs.currentNode)
87 currentNode = currentNode->next;
93 Node& origNode = *currentNode;
94 currentNode = currentNode->next;
100 currentNode = currentNode->prev;
106 Node* node = currentNode;
107 while (decrement > 0)
117 return currentNode->value;
122 return ¤tNode->value;
154 template <
class Type>
198 MemoryManager& theManager) :
199 m_memoryManager(&theManager),
212 destroyNode(pos++.node());
215 Node * freeNode = m_freeListHeadPtr;
216 while (freeNode != 0)
218 Node * nextNode = freeNode->next;
219 deallocate(freeNode);
223 deallocate(m_listHead);
230 assert(m_memoryManager != 0 );
232 return *m_memoryManager;
238 assert(m_memoryManager != 0 );
240 return *m_memoryManager;
246 return iterator(*(getListHead().next));
273 const_reverse_iterator
285 const_reverse_iterator
308 while (item != end())
319 return (begin() == end()) != 0;
325 constructNode(data, end());
331 constructNode(data, begin());
349 return iterator(constructNode(value,pos));
355 assert(pos != end());
356 freeNode(pos.
node());
369 assert(m_memoryManager == list.m_memoryManager);
373 Node & posNode = pos.
node();
374 Node & toInsertNode = toInsert.node();
376 toInsertNode.prev->next = toInsertNode.next;
377 toInsertNode.next->prev = toInsertNode.prev;
379 toInsertNode.prev = posNode.prev;
380 toInsertNode.next = &posNode;
382 posNode.prev->next = &toInsertNode;
383 posNode.prev = &toInsertNode;
398 assert(m_memoryManager == list.m_memoryManager);
400 if (toInsertFirst != toInsertLast)
402 Node & posNode = pos.
node();
403 Node & toInsertFirstNode = toInsertFirst.node();
404 Node & toInsertLastNode = *(toInsertLast.
node().prev);
406 toInsertFirstNode.prev->next = toInsertLastNode.next;
407 toInsertLastNode.next->prev = toInsertFirstNode.prev;
409 toInsertFirstNode.prev = posNode.prev;
410 toInsertLastNode.next = &posNode;
412 posNode.prev->next = &toInsertFirstNode;
413 posNode.prev = &toInsertLastNode;
423 freeNode(pos++.node());
440 Node * nextFreeNode = 0;
442 if (m_freeListHeadPtr != 0)
444 newNode = m_freeListHeadPtr;
445 nextFreeNode = m_freeListHeadPtr->next;
449 m_freeListHeadPtr = allocate(1);
450 newNode = m_freeListHeadPtr;
453 Constructor::construct(&newNode->value, data, *m_memoryManager);
454 new (&newNode->prev) Node*(pos.
node().prev);
455 new (&newNode->next) Node*(&(pos.
node()));
457 pos.
node().prev->next = newNode;
458 pos.
node().prev = newNode;
460 m_freeListHeadPtr = nextFreeNode;
467 node.prev->next = node.next;
468 node.next->prev = node.prev;
472 node.next = m_freeListHeadPtr;
473 m_freeListHeadPtr = &node;
478 assert(&node != m_listHead);
487 m_listHead = allocate(1);
488 m_listHead->next = m_listHead;
489 m_listHead->prev = m_listHead;
497 return const_cast<XalanList*
>(
this)->getListHead();
503 const size_type theBytesNeeded = size *
sizeof(Node);
505 assert(m_memoryManager != 0);
507 void*
pointer = m_memoryManager->allocate(theBytesNeeded);
518 assert(m_memoryManager != 0);
520 m_memoryManager->deallocate(
pointer);
542 #endif // XALANLIST_HEADER_GUARD_1357924680