Leaked source code of windows server 2003
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.

101 lines
2.2 KiB

  1. /*++
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. hashindx.hxx
  5. Abstract:
  6. This class implements a sparse number set with huge (<= ULONG) number
  7. of elements. The numset.cxx implementation uses too much memory when
  8. the number of elements is in the 100,000 range. The numbers stored are
  9. not in any particular order and this implementation only supports a
  10. subset of set operations.
  11. Author:
  12. Daniel Chan (danielch) 05-05-99
  13. --*/
  14. #if !defined(HASH_INDEX_DEFN)
  15. #define HASH_INDEX_DEFN
  16. DECLARE_CLASS( HASH_INDEX );
  17. typedef struct _HASH_INDEX_ELEMENT {
  18. ULONG elementCount; // number of elements in elements
  19. ULONG maxElementCount; // max. number of elements in element
  20. PULONG elements; // pointer to an array of ULONGs
  21. };
  22. DEFINE_TYPE( _HASH_INDEX_ELEMENT, HASH_INDEX_ELEMENT );
  23. class HASH_INDEX : public OBJECT {
  24. public:
  25. DECLARE_CONSTRUCTOR( HASH_INDEX );
  26. VIRTUAL
  27. ~HASH_INDEX(
  28. );
  29. NONVIRTUAL
  30. BOOLEAN
  31. Initialize(
  32. ULONG HashTableSize,
  33. USHORT HashElementIncrement
  34. );
  35. NONVIRTUAL
  36. BOOLEAN
  37. QueryAndAdd(
  38. IN ULONG HashValue,
  39. IN ULONG Index,
  40. OUT PULONG *MatchIndexArray,
  41. OUT PULONG MatchIndexCount
  42. );
  43. NONVIRTUAL
  44. BOOLEAN
  45. RemoveAll(
  46. );
  47. NONVIRTUAL
  48. VOID
  49. RemoveLastEntry(
  50. ULONG HashValue,
  51. ULONG Index
  52. );
  53. NONVIRTUAL
  54. VOID
  55. DumpHashTable(
  56. );
  57. private:
  58. NONVIRTUAL
  59. VOID
  60. Construct (
  61. );
  62. NONVIRTUAL
  63. VOID
  64. Destroy(
  65. );
  66. PHASH_INDEX_ELEMENT _hashTable;
  67. USHORT _hash_table_size;
  68. USHORT _hash_table_mask;
  69. USHORT _hash_table_bits;
  70. USHORT _hash_element_increment;
  71. };
  72. #endif // HASH_INDEX_DEFN