Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.2 KiB

  1. //////////////////////////////////////////////////////////////////////
  2. // Hash.h: interface for the CHash class.
  3. //
  4. // Created by JOEM 03-2000
  5. // Copyright (C) 2000 Microsoft Corporation
  6. // All Rights Reserved
  7. //
  8. /////////////////////////////////////////////////////// JOEM 3-2000 //
  9. #if !defined(AFX_HASH_H__4D944890_12DA_4329_9B53_48B185627578__INCLUDED_)
  10. #define AFX_HASH_H__4D944890_12DA_4329_9B53_48B185627578__INCLUDED_
  11. #if _MSC_VER > 1000
  12. #pragma once
  13. #endif // _MSC_VER > 1000
  14. #include "common.h"
  15. #include <spddkhlp.h>
  16. #include <spcollec.h>
  17. //This should be some large prime number
  18. #define HASH_SIZE 36919
  19. // The main variable within a CHash
  20. class CHashNode
  21. {
  22. public:
  23. CHashNode();
  24. ~CHashNode();
  25. WCHAR* m_pszKey;
  26. IUnknown* m_pValue;
  27. CHashNode* m_pNext;
  28. };
  29. class CHash
  30. {
  31. public:
  32. CHash();
  33. ~CHash();
  34. STDMETHOD(BuildEntry)(const WCHAR* pszKey, IUnknown* pValue);
  35. STDMETHOD(DeleteEntry)(const WCHAR* pszKey);
  36. STDMETHOD(NextKey)(USHORT* punIdx1, USHORT* punIdx2, WCHAR** ppszKey );
  37. IUnknown* Find(const WCHAR* pszKey);
  38. private:
  39. int HashValue(WCHAR* pszKey);
  40. private:
  41. CHashNode* m_heads[HASH_SIZE];
  42. };
  43. #endif // !defined(AFX_HASH_H__4D944890_12DA_4329_9B53_48B185627578__INCLUDED_)