24 #ifndef _ODA_UNIDIRECTIONALLISTT_H_
25 #define _ODA_UNIDIRECTIONALLISTT_H_
31 template<
class T,
class A = OdObjectsAllocator<T>,
class Mm = OdrxMemoryManager>
class OdUnidirectionalList;
38 template<
class T,
class A,
class Mm>
56 CmpValues(
const T&
value)
61 bool operator()(
const T&
value)
const
63 return (m_value ==
value);
240 static SNode*
copyList(SNode* pNode);
248 template<
class T,
class A,
class Mm>
250 : m_pHead(
NULL), m_size(0)
254 template<
class T,
class A,
class Mm>
256 : m_pHead(copyList(list.m_pHead)), m_size(list.m_size)
260 template<
class T,
class A,
class Mm>
266 template<
class T,
class A,
class Mm>
273 m_pHead = copyList(list.m_pHead);
274 m_size = list.m_size;
280 template<
class T,
class A,
class Mm>
283 SNode* pNewNode =
reinterpret_cast<SNode*
>(Mm::Alloc(
sizeof(SNode)));
288 A::construct(&(pNewNode->m_value));
293 template<
class T,
class A,
class Mm>
296 SNode* pNewNode =
reinterpret_cast<SNode*
>(Mm::Alloc(
sizeof(SNode)));
301 A::construct(&(pNewNode->m_value),
value);
306 template<
class T,
class A,
class Mm>
311 A::destroy(&(pNode->m_value));
316 template<
class T,
class A,
class Mm>
323 SNode* pNewNode = pHead = createNode(pNode->m_value);
325 pNewNode->m_pNext =
NULL;
327 for(pNode = pNode->m_pNext; pNode !=
NULL; pNode = pNode->m_pNext)
329 pNewNode->m_pNext = createNode(pNode->m_value);
331 pNewNode->m_pNext->m_pNext =
NULL;
333 pNewNode = pNewNode->m_pNext;
340 template<
class T,
class A,
class Mm>
346 template<
class T,
class A,
class Mm>
352 template<
class T,
class A,
class Mm>
358 template<
class T,
class A,
class Mm>
364 template<
class T,
class A,
class Mm>
370 template<
class T,
class A,
class Mm>
373 return (m_size == 0);
376 template<
class T,
class A,
class Mm>
380 SNode* pNode = createNode(
value);
384 pNode->m_pNext = it.
node()->m_pNext;
385 it.
node()->m_pNext = pNode;
390 pNode->m_pNext = m_pHead;
399 template<
class T,
class A,
class Mm>
402 SNode* pNode = createNode(
value);
404 pNode->m_pNext = m_pHead;
412 template<
class T,
class A,
class Mm>
417 SNode* pNode = it.
node()->m_pNext;
421 it.
node()->m_pNext = pNode->m_pNext;
431 SNode* pNode = m_pHead;
433 m_pHead = m_pHead->m_pNext;
442 template<
class T,
class A,
class Mm>
448 for(pNode = m_pHead; pNode !=
NULL; pNode = pNextNode)
450 pNextNode = pNode->m_pNext;
459 template<
class T,
class A,
class Mm>
463 return find(it, prevIt, CmpValues(
value), prevStartIt);
466 template<
class T,
class A,
class Mm>
469 return find(it, CmpValues(
value));
472 template<
class T,
class A,
class Mm>
481 SNode* pPrevNode = prevStartIt.
node();
482 SNode* pNode = ((pPrevNode !=
NULL) ? pPrevNode->m_pNext : m_pHead);
484 for(; pNode !=
NULL; pPrevNode = pNode, pNode = pNode->m_pNext)
486 if(pred(pNode->m_value))
499 template<
class T,
class A,
class Mm>
507 for(SNode* pNode = m_pHead; pNode !=
NULL; pNode = pNode->m_pNext)
509 if(pred(pNode->m_value))
521 template<
class T,
class A,
class Mm>
524 if(m_size == list.m_size)
526 SNode* pNode1 = m_pHead;
527 SNode* pNode2 = list.m_pHead;
529 for(; pNode1 !=
NULL; pNode1 = pNode1->m_pNext, pNode2 = pNode2->m_pNext)
533 if(pNode1->m_value != pNode2->m_value)
545 #endif // _ODA_UNIDIRECTIONALLISTT_H_