 |
OpenNI 1.5.4
|
Go to the documentation of this file.
280 return XN_STATUS_ILLEGAL_POSITION;
283 return Add(where.m_pCurrent, val);
298 return XN_STATUS_ILLEGAL_POSITION;
301 return Add(where.m_pCurrent->Previous(), val);
319 Iterator iter =
begin();
320 for (; iter !=
end(); ++iter)
343 ConstIterator iter =
begin();
344 for (; iter !=
end(); ++iter)
379 return XN_STATUS_ILLEGAL_POSITION;
383 return XN_STATUS_IS_EMPTY;
386 XnNode* pToRemove = where.m_pCurrent;
421 XnUInt32
Size()
const
502 Init(pNodeAllocator);
531 if (pNewNode == NULL)
533 return XN_STATUS_ALLOC_FAILED;
536 pNewNode->
Data() = val;
540 pWhere->
Next() = pNewNode;
560 #define XN_DECLARE_LIST_WITH_TRANSLATOR_DECL(decl, Type, ClassName, Translator) \
561 class decl ClassName : public XnList \
564 class decl ConstIterator : public XnList::ConstIterator \
567 friend class ClassName; \
568 inline ConstIterator(const ConstIterator& other) : XnList::ConstIterator(other) {} \
569 inline ConstIterator& operator++() \
571 ++(*(XnList::ConstIterator*)this); \
574 inline ConstIterator operator++(int) \
576 ConstIterator result = *this; \
580 inline ConstIterator& operator--() \
582 --(*(XnList::ConstIterator*)this); \
585 inline ConstIterator operator--(int) \
587 ConstIterator result = *this; \
591 inline Type const& operator*() const \
593 return Translator::GetFromValue(**((XnList::ConstIterator*)this)); \
595 inline Type const* operator->() const { return (&**this); } \
597 inline ConstIterator(XnNode* pNode) : XnList::ConstIterator(pNode) {} \
598 inline ConstIterator(const XnList::ConstIterator& other) : \
599 XnList::ConstIterator(other) \
602 class decl Iterator : public ConstIterator \
605 friend class ClassName; \
606 Iterator(const Iterator& other) : ConstIterator(other) {} \
607 inline Iterator& operator++() \
609 ++(*(ConstIterator*)this); \
612 inline Iterator operator++(int) \
614 Iterator result = *this; \
618 inline Iterator& operator--() \
620 --(*(ConstIterator*)this); \
623 inline Iterator operator--(int) \
625 Iterator result = *this; \
629 inline Type& operator*() const { return ((Type&)**(ConstIterator*)this); } \
630 inline Type* operator->() const { return (&**this); } \
632 inline Iterator(XnNode* pNode) : ConstIterator(pNode) {} \
633 inline Iterator(const XnList::Iterator& other) : ConstIterator(other) {} \
644 inline XnStatus AddFirst(Type const& value) \
646 XnValue val = Translator::CreateValueCopy(value); \
647 XnStatus nRetVal = XnList::AddFirst(val); \
648 if (nRetVal != XN_STATUS_OK) \
650 Translator::FreeValue(val); \
653 return XN_STATUS_OK; \
655 inline XnStatus AddLast(Type const& value) \
657 XnValue val = Translator::CreateValueCopy(value); \
658 XnStatus nRetVal = XnList::AddLast(val); \
659 if (nRetVal != XN_STATUS_OK) \
661 Translator::FreeValue(val); \
664 return XN_STATUS_OK; \
666 inline XnStatus AddAfter(ConstIterator where, Type const& value) \
668 XnValue val = Translator::CreateValueCopy(value); \
669 XnStatus nRetVal = XnList::AddAfter(where, val); \
670 if (nRetVal != XN_STATUS_OK) \
672 Translator::FreeValue(val); \
675 return XN_STATUS_OK; \
677 inline XnStatus AddBefore(ConstIterator where, Type const& value) \
679 XnValue val = Translator::CreateValueCopy(value); \
680 XnStatus nRetVal = XnList::AddBefore(where, val); \
681 if (nRetVal != XN_STATUS_OK) \
683 Translator::FreeValue(val); \
686 return XN_STATUS_OK; \
688 inline ConstIterator Find(Type const& value) const \
690 XnValue _value = Translator::GetAsValue(value); \
691 return XnList::Find(_value); \
693 inline Iterator Find(Type const& value) \
695 XnValue _value = Translator::GetAsValue(value); \
696 return XnList::Find(_value); \
698 inline XnStatus Remove(ConstIterator where) \
700 XnValue val = Translator::GetAsValue(*where); \
701 XnStatus nRetVal = XnList::Remove(where); \
702 if (nRetVal != XN_STATUS_OK) return (nRetVal); \
703 Translator::FreeValue(val); \
704 return XN_STATUS_OK; \
706 inline XnStatus Remove(Type const& value) \
708 Iterator it = Find(value); \
711 inline Iterator begin() { return XnList::begin(); } \
712 inline ConstIterator begin() const { return XnList::begin(); } \
713 inline Iterator end() { return XnList::end(); } \
714 inline ConstIterator end() const { return XnList::end(); } \
715 inline Iterator rbegin() { return XnList::rbegin(); } \
716 inline ConstIterator rbegin() const { return XnList::rbegin(); } \
717 inline Iterator rend() { return XnList::rend(); } \
718 inline ConstIterator rend() const { return XnList::rend(); } \
720 virtual XnStatus Remove(XnList::ConstIterator where) \
722 return Remove(ConstIterator(where)); \
725 XN_DISABLE_COPY_AND_ASSIGN(ClassName); \
731 #define XN_DECLARE_LIST_WITH_TRANSLATOR(Type, ClassName, Translator) \
732 XN_DECLARE_LIST_WITH_TRANSLATOR_DECL(, Type, ClassName, Translator)
738 #define XN_DECLARE_LIST_DECL(decl, Type, ClassName) \
739 XN_DECLARE_DEFAULT_VALUE_TRANSLATOR_DECL(decl, Type, XN_DEFAULT_TRANSLATOR_NAME(ClassName)) \
740 XN_DECLARE_LIST_WITH_TRANSLATOR_DECL(decl, Type, ClassName, XN_DEFAULT_TRANSLATOR_NAME(ClassName))
745 #define XN_DECLARE_LIST(Type, ClassName) \
746 XN_DECLARE_LIST_DECL(, Type, ClassName)
XnStatus Remove(ConstIterator where, XnValue &value)
Definition: XnList.h:381
XnNode *& Previous()
Definition: XnNode.h:80
Iterator(const Iterator &other)
Definition: XnList.h:183
#define XN_STATUS_OK
Definition: XnStatus.h:37
XnNode * m_pBase
Definition: XnList.h:567
Iterator rend()
Definition: XnList.h:501
XnUInt32 XnStatus
Definition: XnStatus.h:34
virtual XnNode * Allocate()=0
XnNode *& Next()
Definition: XnNode.h:71
Iterator begin()
Definition: XnList.h:453
XnList()
Definition: XnList.h:239
Iterator & operator--()
Definition: XnList.h:206
XnBool m_bOwnsAllocator
Definition: XnList.h:570
Definition: XnNodeAllocator.h:28
ConstIterator & operator++()
Definition: XnList.h:99
XnBool operator==(const ConstIterator &other) const
Definition: XnList.h:139
Iterator & operator++()
Definition: XnList.h:188
Iterator end()
Definition: XnList.h:469
XnStatus AddLast(const XnValue &value)
Definition: XnList.h:282
XnBool IsEmpty() const
Definition: XnList.h:433
XnNode * m_pCurrent
Definition: XnList.h:187
#define XN_NEW(type, arg)
Definition: XnOS.h:332
XnValue & operator*() const
Definition: XnList.h:224
void Init(INiNodeAllocator *pNodeAllocator)
Definition: XnList.h:526
INiNodeAllocator * m_pNodeAllocator
Definition: XnList.h:569
Definition: IXnNodeAllocator.h:33
XnStatus Clear()
Definition: XnList.h:422
friend class XnNodeManager
Definition: XnList.h:515
XnValue & Data()
Definition: XnNode.h:89
XnStatus AddFirst(const XnValue &value)
Definition: XnList.h:270
XnBool operator!=(const ConstIterator &other) const
Definition: XnList.h:148
const XnNode * GetNode() const
Definition: XnList.h:165
#define XN_DISABLE_COPY_AND_ASSIGN(TypeName)
Definition: XnMacros.h:119
Iterator rbegin()
Definition: XnList.h:485
virtual void Deallocate(XnNode *pNode)=0
XnStatus Add(XnNode *pWhere, const XnValue &val)
Definition: XnList.h:547
Iterator Find(const XnValue &value)
Definition: XnList.h:332
XnStatus AddAfter(ConstIterator where, const XnValue &val)
Definition: XnList.h:296
#define XN_DELETE(p)
Definition: XnOS.h:336
ConstIterator & operator--()
Definition: XnList.h:118
XnUInt32 Size() const
Definition: XnList.h:441
virtual ~XnList()
Definition: XnList.h:249
ConstIterator(const ConstIterator &other)
Definition: XnList.h:94
const XnValue & operator*() const
Definition: XnList.h:156
void * XnValue
Definition: XnDataTypes.h:36
XnStatus AddBefore(ConstIterator where, const XnValue &val)
Definition: XnList.h:314