280 return XN_STATUS_ILLEGAL_POSITION;
298 return XN_STATUS_ILLEGAL_POSITION;
320 for (; iter !=
end(); ++iter)
344 for (; iter !=
end(); ++iter)
379 return XN_STATUS_ILLEGAL_POSITION;
383 return XN_STATUS_IS_EMPTY;
502 Init(pNodeAllocator);
531 if (pNewNode == NULL)
533 return XN_STATUS_ALLOC_FAILED;
536 pNewNode->
Data() = val;
540 pWhere->
Next() = pNewNode;
557 #define XN_DECLARE_LIST_WITH_TRANSLATOR_DECL(decl, Type, ClassName, Translator) \
558 class decl ClassName : public XnList \
561 class decl ConstIterator : public XnList::ConstIterator \
564 friend class ClassName; \
565 inline ConstIterator(const ConstIterator& other) : XnList::ConstIterator(other) {} \
566 inline ConstIterator& operator++() \
568 ++(*(XnList::ConstIterator*)this); \
571 inline ConstIterator operator++(int) \
573 ConstIterator result = *this; \
577 inline ConstIterator& operator--() \
579 --(*(XnList::ConstIterator*)this); \
582 inline ConstIterator operator--(int) \
584 ConstIterator result = *this; \
588 inline Type const& operator*() const \
590 return Translator::GetFromValue(**((XnList::ConstIterator*)this)); \
592 inline Type const* operator->() const { return (&**this); } \
594 inline ConstIterator(XnNode* pNode) : XnList::ConstIterator(pNode) {} \
595 inline ConstIterator(const XnList::ConstIterator& other) : \
596 XnList::ConstIterator(other) \
599 class decl Iterator : public ConstIterator \
602 friend class ClassName; \
603 Iterator(const Iterator& other) : ConstIterator(other) {} \
604 inline Iterator& operator++() \
606 ++(*(ConstIterator*)this); \
609 inline Iterator operator++(int) \
611 Iterator result = *this; \
615 inline Iterator& operator--() \
617 --(*(ConstIterator*)this); \
620 inline Iterator operator--(int) \
622 Iterator result = *this; \
626 inline Type& operator*() const { return ((Type&)**(ConstIterator*)this); } \
627 inline Type* operator->() const { return (&**this); } \
629 inline Iterator(XnNode* pNode) : ConstIterator(pNode) {} \
630 inline Iterator(const XnList::Iterator& other) : ConstIterator(other) {} \
636 ClassName(const ClassName& other) \
645 ClassName& operator=(const ClassName& other) \
648 for (ConstIterator it = other.begin(); it != other.end(); ++it) \
654 inline XnStatus AddFirst(Type const& value) \
656 XnValue val = Translator::CreateValueCopy(value); \
657 XnStatus nRetVal = XnList::AddFirst(val); \
658 if (nRetVal != XN_STATUS_OK) \
660 Translator::FreeValue(val); \
663 return XN_STATUS_OK; \
665 inline XnStatus AddLast(Type const& value) \
667 XnValue val = Translator::CreateValueCopy(value); \
668 XnStatus nRetVal = XnList::AddLast(val); \
669 if (nRetVal != XN_STATUS_OK) \
671 Translator::FreeValue(val); \
674 return XN_STATUS_OK; \
676 inline XnStatus AddAfter(ConstIterator where, Type const& value) \
678 XnValue val = Translator::CreateValueCopy(value); \
679 XnStatus nRetVal = XnList::AddAfter(where, val); \
680 if (nRetVal != XN_STATUS_OK) \
682 Translator::FreeValue(val); \
685 return XN_STATUS_OK; \
687 inline XnStatus AddBefore(ConstIterator where, Type const& value) \
689 XnValue val = Translator::CreateValueCopy(value); \
690 XnStatus nRetVal = XnList::AddBefore(where, val); \
691 if (nRetVal != XN_STATUS_OK) \
693 Translator::FreeValue(val); \
696 return XN_STATUS_OK; \
698 inline ConstIterator Find(Type const& value) const \
700 XnValue _value = Translator::GetAsValue(value); \
701 return XnList::Find(_value); \
703 inline Iterator Find(Type const& value) \
705 XnValue _value = Translator::GetAsValue(value); \
706 return XnList::Find(_value); \
708 inline XnStatus Remove(ConstIterator where) \
710 XnValue val = Translator::GetAsValue(*where); \
711 XnStatus nRetVal = XnList::Remove(where); \
712 if (nRetVal != XN_STATUS_OK) return (nRetVal); \
713 Translator::FreeValue(val); \
714 return XN_STATUS_OK; \
716 inline XnStatus Remove(Type const& value) \
718 Iterator it = Find(value); \
721 inline Iterator begin() { return XnList::begin(); } \
722 inline ConstIterator begin() const { return XnList::begin(); } \
723 inline Iterator end() { return XnList::end(); } \
724 inline ConstIterator end() const { return XnList::end(); } \
725 inline Iterator rbegin() { return XnList::rbegin(); } \
726 inline ConstIterator rbegin() const { return XnList::rbegin(); } \
727 inline Iterator rend() { return XnList::rend(); } \
728 inline ConstIterator rend() const { return XnList::rend(); } \
730 virtual XnStatus Remove(XnList::ConstIterator where) \
732 return Remove(ConstIterator(where)); \
739 #define XN_DECLARE_LIST_WITH_TRANSLATOR(Type, ClassName, Translator) \
740 XN_DECLARE_LIST_WITH_TRANSLATOR_DECL(, Type, ClassName, Translator)
746 #define XN_DECLARE_LIST_DECL(decl, Type, ClassName) \
747 XN_DECLARE_DEFAULT_VALUE_TRANSLATOR_DECL(decl, Type, XN_DEFAULT_TRANSLATOR_NAME(ClassName)) \
748 XN_DECLARE_LIST_WITH_TRANSLATOR_DECL(decl, Type, ClassName, XN_DEFAULT_TRANSLATOR_NAME(ClassName))
753 #define XN_DECLARE_LIST(Type, ClassName) \
754 XN_DECLARE_LIST_DECL(, Type, ClassName)
XnValue & Data()
Definition: XnNode.h:69
XnNode * m_pBase
Definition: XnList.h:547
Iterator rend()
Definition: XnList.h:481
ConstIterator & operator++()
Definition: XnList.h:59
Definition: XnNodeAllocator.h:28
ConstIterator end() const
Definition: XnList.h:457
XnBool operator==(const ConstIterator &other) const
Definition: XnList.h:99
friend class XnNodeManager
Definition: XnList.h:495
XnStatus Remove(ConstIterator where, XnValue &value)
Definition: XnList.h:361
ConstIterator operator++(int)
Definition: XnList.h:68
#define XN_STATUS_OK
Definition: XnStatus.h:37
XnBool operator!=(const ConstIterator &other) const
Definition: XnList.h:108
ConstIterator rbegin() const
Definition: XnList.h:473
ConstIterator(XnNode *pNode)
Definition: XnList.h:144
ConstIterator begin() const
Definition: XnList.h:441
XnNode * GetNode()
Definition: XnList.h:133
XnList(INiNodeAllocator *pNodeAllocator)
Definition: XnList.h:500
ConstIterator operator--(int)
Definition: XnList.h:87
XnBool m_bOwnsAllocator
Definition: XnList.h:550
XnUInt32 XnStatus
Definition: XnStatus.h:34
XnStatus AddAfter(ConstIterator where, const XnValue &val)
Definition: XnList.h:276
virtual XnStatus Remove(ConstIterator where)
Definition: XnList.h:374
void * XnValue
Definition: XnDataTypes.h:36
XnNode * m_pCurrent
Definition: XnList.h:147
Iterator operator++(int)
Definition: XnList.h:176
Iterator rbegin()
Definition: XnList.h:465
Iterator & operator++()
Definition: XnList.h:168
Iterator(XnNode *pNode)
Definition: XnList.h:212
ConstIterator rend() const
Definition: XnList.h:489
XnBool IsEmpty() const
Definition: XnList.h:413
Iterator & operator--()
Definition: XnList.h:186
XnStatus Clear()
Definition: XnList.h:402
XnValue & operator*() const
Definition: XnList.h:204
XnStatus AddBefore(ConstIterator where, const XnValue &val)
Definition: XnList.h:294
Iterator operator--(int)
Definition: XnList.h:194
XnNode *& Previous()
Definition: XnNode.h:60
XnStatus AddFirst(const XnValue &value)
Definition: XnList.h:250
Definition: IXnNodeAllocator.h:33
const XnValue & operator*() const
Definition: XnList.h:116
#define XN_NEW(type, arg)
Definition: XnOS.h:339
#define XN_DELETE(p)
Definition: XnOS.h:343
virtual ~XnList()
Definition: XnList.h:229
XnStatus AddLast(const XnValue &value)
Definition: XnList.h:262
XnList()
Definition: XnList.h:219
XnUInt32 Size() const
Definition: XnList.h:421
INiNodeAllocator * m_pNodeAllocator
Definition: XnList.h:549
Iterator Find(const XnValue &value)
Definition: XnList.h:312
ConstIterator(const ConstIterator &other)
Definition: XnList.h:54
void Init(INiNodeAllocator *pNodeAllocator)
Definition: XnList.h:506
virtual XnNode * Allocate()=0
ConstIterator Find(const XnValue &value) const
Definition: XnList.h:336
const XnNode * GetNode() const
Definition: XnList.h:125
ConstIterator & operator--()
Definition: XnList.h:78
XnNode *& Next()
Definition: XnNode.h:51
Iterator(const Iterator &other)
Definition: XnList.h:163
Iterator end()
Definition: XnList.h:449
Iterator begin()
Definition: XnList.h:433
virtual void Deallocate(XnNode *pNode)=0
XnStatus Add(XnNode *pWhere, const XnValue &val)
Definition: XnList.h:527