9#ifndef __XPHASHTABLE_H__
10#define __XPHASHTABLE_H__
14typedef void* TXpTableItem;
16template <
class KEY,
class TYPE>
36 CXpHashTable(
const INT_PTR nHashTableSize,
const bool bCalculate =
true);
39 inline HRESULT
Insert(
const KEY& Key,
const TYPE& Value);
41 inline HRESULT
Remove(
const KEY& Key);
46 inline bool HasKey(
const KEY& Key)
const;
47 inline TXpTableItem
FindKey(
const KEY& Key)
const;
48 inline bool FindValue(
const KEY& Key, TYPE& Value)
const;
50 inline const KEY&
GetKey(
const TXpTableItem Item)
const;
53 inline const TYPE&
GetValue(
const TXpTableItem Item)
const;
54 inline TYPE&
GetValue(
const TXpTableItem Item);
56 inline void GetPair(
const TXpTableItem Item, KEY& Key, TYPE& Value)
const;
59 inline TXpTableItem
GetNext(
const TXpTableItem Item)
const;
82inline unsigned long XpHashKey(
const KEY& Key)
85 return (
unsigned long)Key >> 4;
88inline unsigned long XpHashKey(
const char* pszString);
89inline unsigned long XpHashKey(
const wchar_t* pszString);
92 inline unsigned long XpHashKey(
const CString& csString);
95#include "xphashtable.inl"
Definition: xphashtable.h:18
HRESULT Copy(const CXpHashTable &HashTable)
HRESULT Intersection(const CXpHashTable &HashTable, CXpHashTable &Result)
INT_PTR m_nCount
Definition: xphashtable.h:33
TXpTableItem GetFirst() const
bool operator==(const CXpHashTable &HashTable) const
TXpTableItem GetNext(const TXpTableItem Item) const
bool FindValue(const KEY &Key, TYPE &Value) const
const TYPE & GetValue(const TXpTableItem Item) const
HRESULT Insert(const KEY &Key, const TYPE &Value)
bool IsPrime(const INT_PTR nNbr)
const KEY & GetKey(const TXpTableItem Item) const
INT_PTR GetBucket(const KEY &Key) const
bool HasKey(const KEY &Key) const
void GetPair(const TXpTableItem Item, KEY &Key, TYPE &Value) const
CXpHashTable(const INT_PTR nHashTableSize, const bool bCalculate=true)
HRESULT Difference(const CXpHashTable &HashTable, CXpHashTable &Result)
INT_PTR GetClosestPrime(const INT_PTR nNbr)
HRESULT Remove(const KEY &Key)
HRESULT Union(const CXpHashTable &HashTable, CXpHashTable &Result)
CXpHashTable & operator=(const CXpHashTable &HashTable)
CXpArray< SNode * > CPtrArray
Definition: xphashtable.h:30
CPtrArray m_Buckets
Definition: xphashtable.h:32
TYPE & GetValue(const TXpTableItem Item)
TXpTableItem FindKey(const KEY &Key) const
Definition: xphashtable.h:22
SNode(const KEY &Key, const TYPE &Value)
Definition: xphashtable.h:23
TYPE m_Value
Definition: xphashtable.h:27
SNode * m_pNext
Definition: xphashtable.h:25
KEY m_Key
Definition: xphashtable.h:26