18 template<
class _TKey,
class _TValue>
44 return (((XnSizeT)key) & 0xff);
47 static XnInt32
Compare(TKey
const& key1, TKey
const& key2)
49 return XnInt32(XnSizeT(key1)-XnSizeT(key2));
303 for (ConstIterator it = other.
Begin(); it != other.
End(); ++it)
305 nRetVal =
Set(it->Key(), it->Value());
315 for (XnUInt32 i = 0; i <
LAST_BIN; ++i)
317 if (m_apBins[i] != NULL)
329 return Iterator(m_apBins, m_nMinBin, m_apBins[m_nMinBin]->
Begin());
337 return ConstIterator(m_apBins, m_nMinBin, m_apBins[m_nMinBin]->
Begin());
367 if (m_apBins[nHash] == NULL)
372 if (nHash < m_nMinBin)
379 for (
typename TPairList::Iterator it = m_apBins[nHash]->
Begin(); it != m_apBins[nHash]->
End(); ++it)
381 if (TKeyManager::Compare(it->Key(), key) == 0)
400 ConstIterator
Find(TKey
const& key)
const
403 typename TPairList::ConstIterator it;
406 return ConstIterator(m_apBins, nBin, it);
424 typename TPairList::Iterator it;
427 return Iterator(m_apBins, nBin, it);
473 ConstIterator it =
Find(key);
476 return XN_STATUS_NO_MATCH;
495 ConstIterator it =
Find(key);
498 return XN_STATUS_NO_MATCH;
502 pValue = &it->Value();
517 Iterator it =
Find(key);
520 return XN_STATUS_NO_MATCH;
539 Iterator it =
Find(key);
542 return XN_STATUS_NO_MATCH;
546 pValue = &it->Value();
559 Iterator it =
Find(key);
562 nRetVal =
Set(key, TValue());
566 XN_ASSERT(it !=
End());
578 return XN_STATUS_ILLEGAL_POSITION;
581 XN_ASSERT(m_apBins == it.m_ppBins);
582 XN_ASSERT(m_apBins[it.m_nCurrBin] != NULL);
584 return m_apBins[it.m_nCurrBin]->
Remove(it.m_currIt);
589 ConstIterator it =
Find(key);
596 return XN_STATUS_NO_MATCH;
625 for (ConstIterator iter =
Begin(); iter !=
End(); ++iter, ++nSize)
632 XnBool
Find(TKey
const& key, XnUInt32& nBin,
typename TPairList::ConstIterator& currIt)
const
636 if (m_apBins[nHash] != NULL)
639 for (
typename TPairList::ConstIterator it = m_apBins[nHash]->
Begin(); it != m_apBins[nHash]->
End(); ++it)
641 if (TKeyManager::Compare(it->Key(), key) == 0)
668 #endif // _XN_HASH_T_H_