24#ifndef _ODA_UNIDIRECTIONALLISTT_H_
25#define _ODA_UNIDIRECTIONALLISTT_H_
31template<
class T,
class A = OdObjectsAllocator<T>,
class Mm = OdrxMemoryManager>
class OdUnidirectionalList;
38template<
class T,
class A,
class Mm>
56 CmpValues(
const T&
value)
61 bool operator()(
const T&
value)
const
63 return (m_value ==
value);
135 ConstIterator operator--(
int)
137 return ConstIterator();
188 Iterator operator--(
int)
240 static SNode*
copyList(SNode* pNode);
248template<
class T,
class A,
class Mm>
250: m_pHead(NULL), m_size(0)
254template<
class T,
class A,
class Mm>
256: m_pHead(copyList(list.m_pHead)), m_size(list.m_size)
260template<
class T,
class A,
class Mm>
266template<
class T,
class A,
class Mm>
273 m_pHead = copyList(list.m_pHead);
274 m_size = list.m_size;
280template<
class T,
class A,
class Mm>
283 SNode* pNewNode =
reinterpret_cast<SNode*
>(Mm::Alloc(
sizeof(SNode)));
288 A::construct(&(pNewNode->m_value));
293template<
class T,
class A,
class Mm>
296 SNode* pNewNode =
reinterpret_cast<SNode*
>(Mm::Alloc(
sizeof(SNode)));
301 A::construct(&(pNewNode->m_value),
value);
306template<
class T,
class A,
class Mm>
311 A::destroy(&(pNode->m_value));
316template<
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;
340template<
class T,
class A,
class Mm>
346template<
class T,
class A,
class Mm>
352template<
class T,
class A,
class Mm>
358template<
class T,
class A,
class Mm>
364template<
class T,
class A,
class Mm>
370template<
class T,
class A,
class Mm>
373 return (m_size == 0);
376template<
class T,
class A,
class Mm>
380 SNode* pNode = createNode(
value);
382 if(it.
node() != NULL)
384 pNode->m_pNext = it.
node()->m_pNext;
385 it.
node()->m_pNext = pNode;
390 pNode->m_pNext = m_pHead;
399template<
class T,
class A,
class Mm>
402 SNode* pNode = createNode(
value);
404 pNode->m_pNext = m_pHead;
412template<
class T,
class A,
class Mm>
415 if(it.
node() != NULL)
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;
442template<
class T,
class A,
class Mm>
448 for(pNode = m_pHead; pNode != NULL; pNode = pNextNode)
450 pNextNode = pNode->m_pNext;
459template<
class T,
class A,
class Mm>
463 return find(it, prevIt, CmpValues(
value), prevStartIt);
466template<
class T,
class A,
class Mm>
469 return find(it, CmpValues(
value));
472template<
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))
499template<
class T,
class A,
class Mm>
507 for(SNode* pNode = m_pHead; pNode != NULL; pNode = pNode->m_pNext)
509 if(pred(pNode->m_value))
521template<
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)
const T * operator->() const
void setNode(SNode *pNode)
bool operator!=(const ConstIterator &it) const
ConstIterator & operator++()
ConstIterator operator++(int)
bool operator==(const ConstIterator &it) const
ConstIterator(SNode *pNode=NULL)
const T & operator*() const
Iterator(SNode *pNode=NULL)
iterator insertAfter(const_iterator it, const T &value=T())
bool operator==(const OdUnidirectionalList &list) const
static SNode * createNode()
static void destroyNode(SNode *pNode)
iterator insertAtBegin(const T &value=T())
iterator removeAfter(const_iterator it)
OdUnidirectionalList & operator=(const OdUnidirectionalList &list)
ConstIterator const_iterator
bool findIf(iterator &it, iterator &prevIt, P pred, const_iterator prevStartIt=const_iterator()) const
static SNode * copyList(SNode *pNode)
bool find(iterator &it, iterator &prevIt, const T &value, const_iterator prevStartIt=const_iterator()) const
GLsizei const GLfloat * value