OpenNI 1.5.7
XnHash.h
Go to the documentation of this file.
1/*****************************************************************************
2* *
3* OpenNI 1.x Alpha *
4* Copyright (C) 2012 PrimeSense Ltd. *
5* *
6* This file is part of OpenNI. *
7* *
8* Licensed under the Apache License, Version 2.0 (the "License"); *
9* you may not use this file except in compliance with the License. *
10* You may obtain a copy of the License at *
11* *
12* http://www.apache.org/licenses/LICENSE-2.0 *
13* *
14* Unless required by applicable law or agreed to in writing, software *
15* distributed under the License is distributed on an "AS IS" BASIS, *
16* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
17* See the License for the specific language governing permissions and *
18* limitations under the License. *
19* *
20*****************************************************************************/
21#ifndef _XN_HASH_H
22#define _XN_HASH_H
23
24//---------------------------------------------------------------------------
25// Includes
26//---------------------------------------------------------------------------
27#include "XnList.h"
28
29//---------------------------------------------------------------------------
30// Defines
31//---------------------------------------------------------------------------
32#define XN_HASH_LAST_BIN 256
33#define XN_HASH_NUM_BINS (XN_HASH_LAST_BIN + 1)
34//---------------------------------------------------------------------------
35// Types
36//---------------------------------------------------------------------------
40typedef XnValue XnKey;
41
45typedef XnUInt8 XnHashValue;
46
50static XnHashValue XnDefaultHashFunction(const XnKey& key)
51{
52 return (XnSizeT(key) & 0xff);
53}
54
58static XnInt32 XnDefaultCompareFunction(const XnKey& key1, const XnKey& key2)
59{
60 return XnInt32(XnSizeT(key1)-XnSizeT(key2));
61}
62
66class XnHash
67{
68public:
73 {
74 public:
75 friend class XnHash;
76
84
89 {
90 ++m_Iterator;
91
92 while (m_Iterator == m_pHash->m_Bins[m_nCurrentBin]->end() &&
94 {
95 do
96 {
98 } while (m_pHash->m_Bins[m_nCurrentBin] == NULL);
100 }
101 return *this;
102 }
103
108 {
109 XnHash::ConstIterator other(*this);
110 ++*this;
111 return other;
112 }
113
118 {
119 --m_Iterator;
120
121 while (m_Iterator == m_pHash->m_Bins[m_nCurrentBin]->end() &&
123 {
124 do
125 {
126 if (m_nCurrentBin == 0)
127 {
130 return *this;
131 }
133 } while (m_pHash->m_Bins[m_nCurrentBin] == NULL);
135 }
136 return *this;
137 }
138
143 {
144 ConstIterator other(*this);
145 --*this;
146 return other;
147 }
148
154 XnBool operator==(const ConstIterator& other) const
155 {
156 return m_Iterator == other.m_Iterator;
157 }
158
164 XnBool operator!=(const ConstIterator& other) const
165 {
166 return m_Iterator != other.m_Iterator;
167 }
168
172 const XnKey& Key() const
173 {
174 return ((XnNode*)(*m_Iterator))->Data();
175 }
176
180 const XnValue& Value() const
181 {
182 return ((XnNode*)(*m_Iterator))->Next()->Data();
183 }
184
189 {
190 return m_Iterator.GetNode();
191 }
192
196 const XnNode* GetNode() const
197 {
198 return m_Iterator.GetNode();
199 }
200
201 protected:
209 ConstIterator(const XnHash* pHash, XnUInt16 nBin, XnList::Iterator listIterator) :
210 m_pHash(pHash), m_nCurrentBin(nBin), m_Iterator(listIterator)
211 {
212 // Find the first valid
213 while (m_Iterator == m_pHash->m_Bins[m_nCurrentBin]->end() &&
215 {
216 do
217 {
219 } while (m_pHash->m_Bins[m_nCurrentBin] == NULL);
221 }
222 }
223
229 ConstIterator(const XnHash* pHash) :
231
238 };
239
243 class Iterator : public ConstIterator
244 {
245 public:
246 friend class XnHash;
247
253 inline Iterator(const Iterator& other) : ConstIterator(other) {}
254
259 {
260 ++(*(ConstIterator*)this);
261 return (*this);
262 }
266 inline Iterator operator++(int)
267 {
268 Iterator result = *this;
269 ++*this;
270 return (result);
271 }
272
277 {
278 --(*(ConstIterator*)this);
279 return (*this);
280 }
285 {
286 Iterator result = *this;
287 --*this;
288 return (result);
289 }
290
294 XnKey& Key() const { return (XnKey&)ConstIterator::Key(); }
295
299 XnValue& Value() const { return (XnValue&)ConstIterator::Value(); }
300
301 protected:
309 Iterator(const XnHash* pHash, XnUInt16 nBin, XnList::Iterator listIterator) :
310 ConstIterator(pHash, nBin, listIterator)
311 {}
312
318 Iterator(const XnHash* pHash) : ConstIterator(pHash) {}
319
320 Iterator(const ConstIterator& other) : ConstIterator(other) {}
321 };
322
323 friend class ConstIterator;
324
325public:
329 typedef XnHashValue (*XnHashFunction)(const XnKey& key);
333 typedef XnInt32 (*XnCompareFunction)(const XnKey& key1, const XnKey& key2);
334
339 {
341 }
342
346 virtual ~XnHash()
347 {
348 if (m_Bins != NULL)
349 {
350 for (int i = 0; i < XN_HASH_NUM_BINS; ++i)
351 {
352 XN_DELETE(m_Bins[i]);
353 }
355 }
356 }
357
364 {
365 return m_nInitStatus;
366 }
367
374 XnStatus Set(const XnKey& key, const XnValue& value)
375 {
376 XnHashValue HashValue = (*m_HashFunction)(key);
377
378 // Check if key already exists
379 if (m_Bins[HashValue] != NULL)
380 {
381 Iterator hiter(this);
382 if (Find(key, HashValue, hiter) == XN_STATUS_OK)
383 {
384 // Replace value
385 hiter.Value() = value;
386 return XN_STATUS_OK;
387 }
388 }
389 else
390 {
391 // First time trying to access this bin, create it.
392 m_Bins[HashValue] = XN_NEW(XnList);
393 if (m_Bins[HashValue] == NULL)
394 {
395 return XN_STATUS_ALLOC_FAILED;
396 }
397 if (HashValue < m_nMinBin)
398 m_nMinBin = HashValue;
399 }
400
401 // Get a new node for the key
402 XnNode* pKeyNode = XnNode::Allocate();
403 if (pKeyNode == NULL)
404 {
405 return XN_STATUS_ALLOC_FAILED;
406 }
407 pKeyNode->Data() = key;
408
409 // Get a new node for the value
410 XnNode* pValueNode = XnNode::Allocate();
411 if (pValueNode == NULL)
412 {
413 XnNode::Deallocate(pKeyNode);
414 return XN_STATUS_ALLOC_FAILED;
415 }
416 pValueNode->Data() = value;
417
418 // Concatenate the value node to the key node
419 pKeyNode->Next() = pValueNode;
420 pValueNode->Next() = NULL;
421
422 // Add the 2 nodes as the value to the key's list
423 XnStatus ListStatus = m_Bins[HashValue]->AddLast(XnValue(pKeyNode));
424 if (ListStatus != XN_STATUS_OK)
425 {
426 // Add failed. return the 2 nodes to the pool
427 XnNode::Deallocate(pKeyNode);
428 XnNode::Deallocate(pValueNode);
429 return ListStatus;
430 }
431
432 return XN_STATUS_OK;
433 }
434
443 XnStatus Get(const XnKey& key, XnValue& value) const
444 {
445 // Check if key exists
446 Iterator hiter(this);
447 XnStatus FindStatus = Find(key, hiter);
448 if (FindStatus != XN_STATUS_OK)
449 {
450 // Key doesn't exist!
451 return FindStatus;
452 }
453 value = hiter.Value();
454
455 return XN_STATUS_OK;
456 }
457
466 XnStatus Remove(const XnKey& key, XnValue& value)
467 {
468 // find the entry to which the key belongs
469 Iterator hiter(this);
470
471 XnStatus FindStatus = Find(key, hiter);
472 if (FindStatus != XN_STATUS_OK)
473 {
474 // no such entry!
475 return FindStatus;
476 }
477
478 // Remove by iterator
479 value = hiter.Value();
480 return Remove(hiter);
481 }
482
493 {
494 if (iter == end())
495 {
496 // Can't remove invalid node
497 return XN_STATUS_ILLEGAL_POSITION;
498 }
499
500 // Get value and key, to return to the caller
501 value = iter.Value();
502 key = iter.Key();
503
504 return Remove(iter);
505 }
506
515 {
516 if (iter == end())
517 {
518 // Can't remove invalid node
519 return XN_STATUS_ILLEGAL_POSITION;
520 }
521
522 XnNode* pNode = iter.GetNode();
523
524 XnNode* pKeyNode = (XnNode*)(pNode->Data());
525 XnNode* pValueNode = pKeyNode->Next();
526
527 // Return the nodes to the pool
528 XnNode::Deallocate(pKeyNode);
529 XnNode::Deallocate(pValueNode);
530
531 pNode->Previous()->Next() = pNode->Next();
532 pNode->Next()->Previous() = pNode->Previous();
533
534 XnNode::Deallocate(pNode);
535
536 return XN_STATUS_OK;
537 }
538
539
544 {
545 while (begin() != end())
546 Remove(begin());
547
548 return XN_STATUS_OK;
549 }
550
554 XnBool IsEmpty() const
555 {
556 return (begin() == end());
557 }
558
562 XnUInt32 Size() const
563 {
564 XnUInt32 nSize = 0;
565 for (Iterator iter = begin(); iter != end(); ++iter, ++nSize)
566 ;
567
568 return nSize;
569 }
570
579 XnStatus Find(const XnKey& key, ConstIterator& hiter) const
580 {
581 return ConstFind(key, hiter);
582 }
583
592 XnStatus Find(const XnKey& key, Iterator& hiter)
593 {
594 XnStatus nRetVal = XN_STATUS_OK;
595
596 ConstIterator& it = hiter;
597 nRetVal = ConstFind(key, it);
598 XN_IS_STATUS_OK(nRetVal);
599
600 return (XN_STATUS_OK);
601 }
602
607 {
608 return Iterator(this, m_nMinBin, m_Bins[m_nMinBin]->begin());
609 }
610
615 {
616 return ConstIterator(this, m_nMinBin, m_Bins[m_nMinBin]->begin());
617 }
618
623 {
625 }
626
631 {
633 }
634
643 {
644 if (begin() != end())
645 {
646 return XN_STATUS_IS_NOT_EMPTY;
647 }
648 m_HashFunction = hashFunction;
649 return XN_STATUS_OK;
650 }
651
660 {
661 if (begin() != end())
662 {
663 return XN_STATUS_IS_NOT_EMPTY;
664 }
665 m_CompareFunction = compareFunction;
666 return XN_STATUS_OK;
667 }
668
669protected:
670
672 {
675
676 for (int i = 0; i < XN_HASH_NUM_BINS; i++)
677 {
678 m_Bins[i] = NULL;
679 }
680
681 m_Bins[XN_HASH_LAST_BIN] = XN_NEW(XnList); // We need this for an end() iterator
683
685 m_CompareFunction = &XnDefaultCompareFunction;
686 m_HashFunction = &XnDefaultHashFunction;
687 return XN_STATUS_OK;
688 }
689
699 XnStatus Find(const XnKey& key, XnHashValue hashValue, ConstIterator& hiter) const
700 {
701 if (m_Bins[hashValue] != NULL)
702 {
703 hiter = ConstIterator(this, hashValue, m_Bins[hashValue]->begin());
704 for (XnList::ConstIterator iter = m_Bins[hashValue]->begin();
705 iter != m_Bins[hashValue]->end(); ++iter, ++hiter)
706 {
707 if ((*m_CompareFunction)(key, hiter.Key()) == 0)
708 return XN_STATUS_OK;
709 }
710 }
711
712 return XN_STATUS_NO_MATCH;
713 }
714
715
718
719 XnUInt16 m_nMinBin;
720
721 /* Status of initialization - could be an error if memory could not be allocated. */
723
728
729private:
731
732 XnStatus ConstFind(const XnKey& key, ConstIterator& hiter) const
733 {
734 XnHashValue HashValue = (*m_HashFunction)(key);
735 return Find(key, HashValue, hiter);
736 }
737};
738
743#define XN_DECLARE_DEFAULT_KEY_MANAGER_DECL(decl, KeyType, ClassName, KeyTranslator) \
744 class decl ClassName \
745 { \
746 public: \
747 inline static XnHashValue Hash(KeyType const& key) \
748 { \
749 const XnKey _key = KeyTranslator::GetAsValue(key); \
750 return XnDefaultHashFunction(_key); \
751 } \
752 inline static XnInt32 Compare(KeyType const& key1, KeyType const& key2) \
753 { \
754 const XnKey _key1 = KeyTranslator::GetAsValue(key1); \
755 const XnKey _key2 = KeyTranslator::GetAsValue(key2); \
756 return XnDefaultCompareFunction(_key1, _key2); \
757 } \
758 };
759
764#define XN_DECLARE_DEFAULT_KEY_MANAGER(KeyType, ClassName, KeyTranslator) \
765 XN_DECLARE_DEFAULT_KEY_MANAGER_DECL(, KeyType, ClassName, KeyTranslator)
766
772#define XN_DECLARE_HASH_DECL(decl, KeyType, ValueType, ClassName, KeyTranslator, ValueTranslator, KeyManager) \
773 class decl ClassName : public XnHash \
774 { \
775 public: \
776 class decl ConstIterator : public XnHash::ConstIterator \
777 { \
778 public: \
779 friend class ClassName; \
780 inline ConstIterator(const ConstIterator& other) : XnHash::ConstIterator(other) {} \
781 inline ConstIterator& operator++() \
782 { \
783 ++(*(XnHash::ConstIterator*)this); \
784 return (*this); \
785 } \
786 inline ConstIterator operator++(int) \
787 { \
788 ConstIterator result = *this; \
789 ++*this; \
790 return result; \
791 } \
792 inline ConstIterator& operator--() \
793 { \
794 --(*(XnHash::ConstIterator*)this); \
795 return (*this); \
796 } \
797 inline ConstIterator operator--(int) \
798 { \
799 ConstIterator result = *this; \
800 --*this; \
801 return result; \
802 } \
803 inline KeyType const& Key() const \
804 { \
805 return KeyTranslator::GetFromValue(XnHash::ConstIterator::Key()); \
806 } \
807 inline ValueType const& Value() const \
808 { \
809 return ValueTranslator::GetFromValue(XnHash::ConstIterator::Value()); \
810 } \
811 protected: \
812 inline ConstIterator(const XnHash::ConstIterator& other) : \
813 XnHash::ConstIterator(other) {} \
814 }; \
815 class decl Iterator : public ConstIterator \
816 { \
817 public: \
818 friend class ClassName; \
819 inline Iterator(const Iterator& other) : ConstIterator(other) {} \
820 inline Iterator& operator++() \
821 { \
822 ++(*(ConstIterator*)this); \
823 return (*this); \
824 } \
825 inline Iterator operator++(int) \
826 { \
827 Iterator result = *this; \
828 ++*this; \
829 return result; \
830 } \
831 inline Iterator& operator--() \
832 { \
833 --(*(ConstIterator*)this); \
834 return (*this); \
835 } \
836 inline Iterator operator--(int) \
837 { \
838 Iterator result = *this; \
839 --*this; \
840 return result; \
841 } \
842 inline KeyType& Key() const \
843 { \
844 return (KeyType&)ConstIterator::Key(); \
845 } \
846 inline ValueType& Value() const \
847 { \
848 return (ValueType&)ConstIterator::Value(); \
849 } \
850 protected: \
851 inline Iterator(const XnHash::Iterator& other) : ConstIterator(other) {} \
852 }; \
853 public: \
854 ClassName() \
855 { \
856 SetHashFunction(Hash); \
857 SetCompareFunction(Compare); \
858 } \
859 virtual ~ClassName() \
860 { \
861 while (!IsEmpty()) \
862 Remove(begin()); \
863 } \
864 XnStatus Set(KeyType const& key, ValueType const& value) \
865 { \
866 Iterator oldIt = begin(); \
867 if (Find(key, oldIt) == XN_STATUS_OK) \
868 { \
869 oldIt.Value() = value; \
870 } \
871 else \
872 { \
873 XnKey _key = KeyTranslator::CreateValueCopy(key); \
874 XnValue _value = ValueTranslator::CreateValueCopy(value); \
875 XnStatus nRetVal = XnHash::Set(_key, _value); \
876 if (nRetVal != XN_STATUS_OK) \
877 { \
878 KeyTranslator::FreeValue(_key); \
879 ValueTranslator::FreeValue(_value); \
880 return (nRetVal); \
881 } \
882 } \
883 return XN_STATUS_OK; \
884 } \
885 XnStatus Get(KeyType const& key, ValueType& value) const \
886 { \
887 XnKey _key = KeyTranslator::GetAsValue(key); \
888 XnValue _value; \
889 XnStatus nRetVal = XnHash::Get(_key, _value); \
890 if (nRetVal != XN_STATUS_OK) return (nRetVal); \
891 value = ValueTranslator::GetFromValue(_value); \
892 return XN_STATUS_OK; \
893 } \
894 XnStatus Get(KeyType const& key, ValueType*& pValue) const \
895 { \
896 XnKey _key = KeyTranslator::GetAsValue(key); \
897 XnValue _value; \
898 XnStatus nRetVal = XnHash::Get(_key, _value); \
899 if (nRetVal != XN_STATUS_OK) return (nRetVal); \
900 pValue = &ValueTranslator::GetFromValue(_value); \
901 return XN_STATUS_OK; \
902 } \
903 XnStatus Remove(KeyType const& key) \
904 { \
905 ValueType dummy; \
906 return Remove(key, dummy); \
907 } \
908 XnStatus Remove(KeyType const& key, ValueType& value) \
909 { \
910 ConstIterator it = end(); \
911 XnStatus nRetVal = Find(key, it); \
912 if (nRetVal != XN_STATUS_OK) return (nRetVal); \
913 value = it.Value(); \
914 return Remove(it); \
915 } \
916 inline XnStatus Remove(ConstIterator iter) \
917 { \
918 XnKey key = KeyTranslator::GetAsValue(iter.Key()); \
919 XnValue value = ValueTranslator::GetAsValue(iter.Value()); \
920 XnStatus nRetVal = XnHash::Remove(iter); \
921 if (nRetVal != XN_STATUS_OK) return (nRetVal); \
922 KeyTranslator::FreeValue(key); \
923 ValueTranslator::FreeValue(value); \
924 return XN_STATUS_OK; \
925 } \
926 XnStatus Find(KeyType const& key, ConstIterator& hiter) const \
927 { \
928 XnKey _key = KeyTranslator::GetAsValue(key); \
929 XnHash::ConstIterator it = XnHash::end(); \
930 XnStatus nRetVal = XnHash::Find(_key, it); \
931 if (nRetVal != XN_STATUS_OK) return (nRetVal); \
932 hiter = it; \
933 return XN_STATUS_OK; \
934 } \
935 XnStatus Find(KeyType const& key, Iterator& hiter) \
936 { \
937 XnKey _key = KeyTranslator::GetAsValue(key); \
938 XnHash::Iterator it = XnHash::end(); \
939 XnStatus nRetVal = XnHash::Find(_key, it); \
940 if (nRetVal != XN_STATUS_OK) return (nRetVal); \
941 hiter = it; \
942 return XN_STATUS_OK; \
943 } \
944 inline Iterator begin() { return XnHash::begin(); } \
945 inline ConstIterator begin() const { return XnHash::begin(); } \
946 inline Iterator end() { return XnHash::end(); } \
947 inline ConstIterator end() const { return XnHash::end(); } \
948 protected: \
949 virtual XnStatus Remove(XnHash::ConstIterator iter) \
950 { \
951 return Remove(ConstIterator(iter)); \
952 } \
953 inline static XnHashValue Hash(const XnKey& key) \
954 { \
955 KeyType const& _key = KeyTranslator::GetFromValue(key); \
956 return KeyManager::Hash(_key); \
957 } \
958 inline static XnInt32 Compare(const XnKey& key1, const XnKey& key2) \
959 { \
960 KeyType const _key1 = KeyTranslator::GetFromValue(key1); \
961 KeyType const _key2 = KeyTranslator::GetFromValue(key2); \
962 return KeyManager::Compare(_key1, _key2); \
963 } \
964 private: \
965 XN_DISABLE_COPY_AND_ASSIGN(ClassName); \
966 };
967
972#define XN_DECLARE_HASH(KeyType, ValueType, ClassName, KeyTranslator, ValueTranslator, KeyManager) \
973 XN_DECLARE_HASH_DECL(, KeyType, ValueType, ClassName, KeyTranslator, ValueTranslator, KeyManager)
974
975#define _XN_DEFAULT_KEY_MANAGER_NAME(ClassName) _##ClassName##Manager
976
982#define XN_DECLARE_DEFAULT_MANAGER_HASH_DECL(decl, KeyType, ValueType, ClassName, KeyTranslator, ValueTranslator) \
983 XN_DECLARE_DEFAULT_KEY_MANAGER_DECL(decl, KeyType, _XN_DEFAULT_KEY_MANAGER_NAME(ClassName), KeyTranslator) \
984 XN_DECLARE_HASH_DECL(decl, KeyType, ValueType, ClassName, KeyTranslator, ValueTranslator, _XN_DEFAULT_KEY_MANAGER_NAME(ClassName))
985
990#define XN_DECLARE_DEFAULT_MANAGER_HASH(decl, KeyType, ValueType, ClassName, KeyTranslator, ValueTranslator) \
991 XN_DECLARE_DEFAULT_MANAGER_HASH_DECL(, KeyType, ValueType, ClassName, KeyTranslator, ValueTranslator)
992
993#define _XN_DEFAULT_KEY_TRANSLATOR(ClassName) _##ClassName##KeyTranslator
994#define _XN_DEFAULT_VALUE_TRANSLATOR(ClassName) _##ClassName##ValueTranslator
995
1001#define XN_DECLARE_DEFAULT_HASH_DECL(decl, KeyType, ValueType, ClassName) \
1002 XN_DECLARE_DEFAULT_VALUE_TRANSLATOR_DECL(decl, KeyType, _XN_DEFAULT_KEY_TRANSLATOR(ClassName)) \
1003 XN_DECLARE_DEFAULT_VALUE_TRANSLATOR_DECL(decl, ValueType, _XN_DEFAULT_VALUE_TRANSLATOR(ClassName)) \
1004 XN_DECLARE_DEFAULT_MANAGER_HASH_DECL(decl, KeyType, ValueType, ClassName, _XN_DEFAULT_KEY_TRANSLATOR(ClassName), _XN_DEFAULT_VALUE_TRANSLATOR(ClassName))
1005
1010#define XN_DECLARE_DEFAULT_HASH(KeyType, ValueType, ClassName) \
1011 XN_DECLARE_DEFAULT_HASH_DECL(, KeyType, ValueType, ClassName)
1012
1013#endif // _XN_HASH_H
void * XnValue
Definition XnDataTypes.h:35
XnValue XnKey
Definition XnHash.h:40
#define XN_HASH_LAST_BIN
Definition XnHash.h:32
#define XN_HASH_NUM_BINS
Definition XnHash.h:33
XnUInt8 XnHashValue
Definition XnHash.h:45
#define XN_IS_STATUS_OK(x)
Definition XnMacros.h:59
#define XN_DISABLE_COPY_AND_ASSIGN(TypeName)
Definition XnMacros.h:118
#define XN_VALIDATE_ALLOC_PTR(x)
Definition XnOS.h:131
#define XN_DELETE(p)
Definition XnOS.h:339
#define XN_NEW(type,...)
Definition XnOS.h:329
#define XN_DELETE_ARR(p)
Definition XnOS.h:340
#define XN_NEW_ARR(type, count)
Definition XnOS.h:338
XnUInt32 XnStatus
Definition XnStatus.h:33
#define XN_STATUS_OK
Definition XnStatus.h:36
Definition XnHash.h:73
XnUInt16 m_nCurrentBin
Definition XnHash.h:235
ConstIterator(const XnHash *pHash)
Definition XnHash.h:229
const XnNode * GetNode() const
Definition XnHash.h:196
ConstIterator operator--(int)
Definition XnHash.h:142
XnBool operator==(const ConstIterator &other) const
Definition XnHash.h:154
ConstIterator & operator++()
Definition XnHash.h:88
XnNode * GetNode()
Definition XnHash.h:188
const XnValue & Value() const
Definition XnHash.h:180
XnBool operator!=(const ConstIterator &other) const
Definition XnHash.h:164
const XnKey & Key() const
Definition XnHash.h:172
ConstIterator & operator--()
Definition XnHash.h:117
const XnHash * m_pHash
Definition XnHash.h:233
ConstIterator operator++(int)
Definition XnHash.h:107
XnList::Iterator m_Iterator
Definition XnHash.h:237
ConstIterator(const XnHash *pHash, XnUInt16 nBin, XnList::Iterator listIterator)
Definition XnHash.h:209
ConstIterator(const ConstIterator &other)
Definition XnHash.h:82
Definition XnHash.h:244
Iterator(const XnHash *pHash)
Definition XnHash.h:318
Iterator operator++(int)
Definition XnHash.h:266
Iterator(const XnHash *pHash, XnUInt16 nBin, XnList::Iterator listIterator)
Definition XnHash.h:309
Iterator(const Iterator &other)
Definition XnHash.h:253
Iterator & operator++()
Definition XnHash.h:258
XnKey & Key() const
Definition XnHash.h:294
Iterator & operator--()
Definition XnHash.h:276
XnValue & Value() const
Definition XnHash.h:299
Iterator operator--(int)
Definition XnHash.h:284
Iterator(const ConstIterator &other)
Definition XnHash.h:320
Definition XnHash.h:67
XnList ** m_Bins
Definition XnHash.h:717
XnStatus SetCompareFunction(XnCompareFunction compareFunction)
Definition XnHash.h:659
XnHashFunction m_HashFunction
Definition XnHash.h:725
ConstIterator begin() const
Definition XnHash.h:614
XnHashValue(* XnHashFunction)(const XnKey &key)
Definition XnHash.h:329
Iterator begin()
Definition XnHash.h:606
XnStatus Find(const XnKey &key, ConstIterator &hiter) const
Definition XnHash.h:579
XnUInt16 m_nMinBin
Definition XnHash.h:719
XnUInt32 Size() const
Definition XnHash.h:562
XnStatus Get(const XnKey &key, XnValue &value) const
Definition XnHash.h:443
friend class ConstIterator
Definition XnHash.h:323
XnBool IsEmpty() const
Definition XnHash.h:554
XnStatus Clear()
Definition XnHash.h:543
XnStatus GetInitStatus() const
Definition XnHash.h:363
ConstIterator end() const
Definition XnHash.h:630
XnStatus m_nInitStatus
Definition XnHash.h:722
XnStatus Init()
Definition XnHash.h:671
virtual XnStatus Remove(ConstIterator iter)
Definition XnHash.h:514
XnCompareFunction m_CompareFunction
Definition XnHash.h:727
virtual ~XnHash()
Definition XnHash.h:346
XnInt32(* XnCompareFunction)(const XnKey &key1, const XnKey &key2)
Definition XnHash.h:333
XnStatus SetHashFunction(XnHashFunction hashFunction)
Definition XnHash.h:642
XnStatus Set(const XnKey &key, const XnValue &value)
Definition XnHash.h:374
Iterator end()
Definition XnHash.h:622
XnHash()
Definition XnHash.h:338
XnStatus Remove(const XnKey &key, XnValue &value)
Definition XnHash.h:466
XnStatus Remove(ConstIterator iter, XnKey &key, XnValue &value)
Definition XnHash.h:492
XnStatus Find(const XnKey &key, Iterator &hiter)
Definition XnHash.h:592
XnStatus Find(const XnKey &key, XnHashValue hashValue, ConstIterator &hiter) const
Definition XnHash.h:699
Definition XnList.h:44
const XnNode * GetNode() const
Definition XnList.h:124
Definition XnList.h:153
Definition XnList.h:41
Iterator end()
Definition XnList.h:448
XnStatus AddLast(const XnValue &value)
Definition XnList.h:261
Iterator rbegin()
Definition XnList.h:464
Iterator begin()
Definition XnList.h:432
Definition XnNode.h:37
static void Deallocate(XnNode *pNode)
Definition XnNode.h:40
XnNode *& Previous()
Definition XnNode.h:59
static XnNode * Allocate()
Definition XnNode.h:39
XnValue & Data()
Definition XnNode.h:68
XnNode *& Next()
Definition XnNode.h:50