38 template<
class _TKey,
class _TValue>
64 return (((XnSizeT)key) & 0xff);
67 static XnInt32
Compare(TKey
const& key1, TKey
const& key2)
69 return XnInt32(XnSizeT(key1)-XnSizeT(key2));
323 for (ConstIterator it = other.
Begin(); it != other.
End(); ++it)
325 nRetVal =
Set(it->Key(), it->Value());
335 for (XnUInt32 i = 0; i <
LAST_BIN; ++i)
337 if (m_apBins[i] != NULL)
349 return Iterator(m_apBins, m_nMinBin, m_apBins[m_nMinBin]->
Begin());
357 return ConstIterator(m_apBins, m_nMinBin, m_apBins[m_nMinBin]->
Begin());
387 if (m_apBins[nHash] == NULL)
392 if (nHash < m_nMinBin)
399 for (
typename TPairList::Iterator it = m_apBins[nHash]->
Begin(); it != m_apBins[nHash]->
End(); ++it)
401 if (TKeyManager::Compare(it->Key(), key) == 0)
420 ConstIterator
Find(TKey
const& key)
const
423 typename TPairList::ConstIterator it;
426 return ConstIterator(m_apBins, nBin, it);
444 typename TPairList::Iterator it;
447 return Iterator(m_apBins, nBin, it);
493 ConstIterator it =
Find(key);
496 return XN_STATUS_NO_MATCH;
515 ConstIterator it =
Find(key);
518 return XN_STATUS_NO_MATCH;
522 pValue = &it->Value();
537 Iterator it =
Find(key);
540 return XN_STATUS_NO_MATCH;
559 Iterator it =
Find(key);
562 return XN_STATUS_NO_MATCH;
566 pValue = &it->Value();
579 Iterator it =
Find(key);
582 nRetVal =
Set(key, TValue());
586 XN_ASSERT(it !=
End());
598 return XN_STATUS_ILLEGAL_POSITION;
601 XN_ASSERT(m_apBins == it.m_ppBins);
602 XN_ASSERT(m_apBins[it.m_nCurrBin] != NULL);
604 return m_apBins[it.m_nCurrBin]->
Remove(it.m_currIt);
609 ConstIterator it =
Find(key);
616 return XN_STATUS_NO_MATCH;
645 for (ConstIterator iter =
Begin(); iter !=
End(); ++iter, ++nSize)
652 XnBool
Find(TKey
const& key, XnUInt32& nBin,
typename TPairList::ConstIterator& currIt)
const
656 if (m_apBins[nHash] != NULL)
659 for (
typename TPairList::ConstIterator it = m_apBins[nHash]->
Begin(); it != m_apBins[nHash]->
End(); ++it)
661 if (TKeyManager::Compare(it->Key(), key) == 0)
688 #endif // _XN_HASH_T_H_