NITE 1.5.1 - API Reference

XnVMultipleHands.h

Go to the documentation of this file.
00001 /*******************************************************************************
00002 *                                                                              *
00003 *   PrimeSense NITE 1.3                                                        *
00004 *   Copyright (C) 2010 PrimeSense Ltd.                                         *
00005 *                                                                              *
00006 *******************************************************************************/
00007 
00008 
00009 #ifndef _XNV_MULTIPLE_HANDS_H_
00010 #define _XNV_MULTIPLE_HANDS_H_
00011 
00012 #include "XnVHandPointContext.h"
00013 
00014 class XnVIntHash;
00015 class XnVIntList;
00016 
00022 class XNV_NITE_API XnVMultipleHands
00023 {
00024 public:
00028     XnVMultipleHands();
00034     XnVMultipleHands(const XnVMultipleHands& other);
00035     ~XnVMultipleHands();
00036 
00042     XnStatus Add(const XnVHandPointContext* pContext);
00050     XnStatus Remove(XnUInt32 nID);
00051 
00059     XnVHandPointContext* GetContext(XnUInt32 nID); 
00067     const XnVHandPointContext* GetContext(XnUInt32 nID) const;
00073     XnVHandPointContext* GetPrimaryContext();
00079     const XnVHandPointContext* GetPrimaryContext() const;
00080 
00086     void MarkNew(XnUInt32 nID);
00092     void MarkOld(XnUInt32 nID);
00098     void MarkActive(XnUInt32 nID);
00099 
00105     void RemoveNew(XnUInt32 nID);
00111     void RemoveOld(XnUInt32 nID);
00117     void RemoveActive(XnUInt32 nID);
00118 
00124     XnUInt32 NewEntries() const;
00130     XnUInt32 OldEntries() const;
00136     XnUInt32 ActiveEntries() const;
00137 
00143     void Clone(XnVMultipleHands& other) const;
00144 
00148     void Clear();
00152     void ClearLists();
00156     void ClearNewList();
00160     void ClearOldList();
00161 
00165     class XNV_NITE_API ConstIterator
00166     {
00167     public:
00168         friend class XnVMultipleHands;
00169 
00175         ConstIterator(const ConstIterator& other);
00176 
00182         ConstIterator& operator++();
00188         ConstIterator operator++(int);
00189 
00195         XnBool operator==(const ConstIterator& other) const;
00201         XnBool operator!=(const ConstIterator& other) const;
00202 
00208         const XnVHandPointContext* operator*() const;
00209 
00215         XnBool IsNew() const;
00221         XnBool IsActive() const;
00227         XnBool IsValid() const;
00228     protected:
00229         ConstIterator(const XnVMultipleHands* pHands);
00230         ConstIterator(const XnVMultipleHands* pHands, XnUInt32 nPosition);
00231 
00232         const XnVMultipleHands* m_pHands;
00233         XnUInt32 m_nPosition;
00234         XnBool m_bValid;
00235     };
00236 
00240     class XNV_NITE_API Iterator : public ConstIterator
00241     {
00242     public:
00243         friend class XnVMultipleHands;
00244 
00250         Iterator(const Iterator& other);
00251 
00257         Iterator& operator++();
00263         Iterator operator++(int);
00264 
00270         XnVHandPointContext* operator*() const;
00271     protected:
00272         Iterator(XnVMultipleHands* pHands);
00273         Iterator(XnVMultipleHands* pHands, XnUInt32 nPosition);
00274     };
00275 
00276     class XNV_NITE_API ConstIteratorOld
00277     {
00278     public:
00279         friend class XnVMultipleHands;
00280         ConstIteratorOld(const ConstIteratorOld& other);
00281         ConstIteratorOld& operator++();
00282         ConstIteratorOld operator++(int);
00283         XnBool operator==(const ConstIteratorOld& other) const;
00284         XnBool operator!=(const ConstIteratorOld& other) const;
00285         XnUInt32 operator*() const;
00286     protected:
00287         ConstIteratorOld(const XnVIntList* pList);
00288         ConstIteratorOld(const XnVIntList* pList, XnUInt32 nPosition);
00289 
00290         const XnVIntList* m_pList;
00291         XnUInt32 m_nPosition;
00292         XnBool m_bValid;
00293         XnUInt32 m_nSize;
00294     };
00295 
00299     class XNV_NITE_API IteratorOld : public ConstIteratorOld
00300     {
00301     public:
00302         friend class XnVMultipleHands;
00303 
00304         IteratorOld(const IteratorOld& other);
00305         IteratorOld& operator++();
00306         IteratorOld operator++(int);
00307     protected:
00308         IteratorOld(XnVIntList* pList);
00309         IteratorOld(XnVIntList* pList, XnUInt32 nPosition);
00310     };
00311 
00317     Iterator begin();
00323     ConstIterator begin() const;
00329     Iterator end();
00335     ConstIterator end() const;
00336 
00344     Iterator Find(XnUInt32 nID);
00352     ConstIterator Find(XnUInt32 nID) const;
00360     XnBool IsNew(XnUInt32 nID) const;
00368     XnBool IsOld(XnUInt32 nID) const;
00376     XnBool IsActive(XnUInt32 nID) const;
00377 
00383     IteratorOld beginOld();
00389     ConstIteratorOld beginOld() const;
00395     IteratorOld endOld();
00401     ConstIteratorOld endOld() const;
00402 
00406     void ReassignPrimary(XnUInt32 nHint = 0);
00407 
00413     void SetFocusPoint(const XnPoint3D& ptFocusPoint);
00419     const XnPoint3D& GetFocusPoint() const;
00420 private:
00421     XnVHandPointContext m_Hands[32];
00422     XnUInt32 m_nNextAvailable;
00423     XnUInt32 m_nAvailable;
00424 
00425     XnVIntList* m_pActiveIDs;
00426     XnVIntList* m_pNewIDs;
00427     XnVIntList* m_pOldIDs;
00428 
00429     XnUInt32 m_nPrimaryID;
00430 
00431     XnPoint3D m_ptFocusPoint;
00432 };
00433 
00434 #endif