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.

97 lines
2.1 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. --*/
  12. #if !defined(HASH_INDEX_DEFN)
  13. #define HASH_INDEX_DEFN
  14. DECLARE_CLASS( HASH_INDEX );
  15. typedef struct _HASH_INDEX_ELEMENT {
  16. ULONG elementCount; // number of elements in elements
  17. ULONG maxElementCount; // max. number of elements in element
  18. PULONG elements; // pointer to an array of ULONGs
  19. };
  20. DEFINE_TYPE( _HASH_INDEX_ELEMENT, HASH_INDEX_ELEMENT );
  21. class HASH_INDEX : public OBJECT {
  22. public:
  23. DECLARE_CONSTRUCTOR( HASH_INDEX );
  24. VIRTUAL
  25. ~HASH_INDEX(
  26. );
  27. NONVIRTUAL
  28. BOOLEAN
  29. Initialize(
  30. ULONG HashTableSize,
  31. USHORT HashElementIncrement
  32. );
  33. NONVIRTUAL
  34. BOOLEAN
  35. QueryAndAdd(
  36. IN ULONG HashValue,
  37. IN ULONG Index,
  38. OUT PULONG *MatchIndexArray,
  39. OUT PULONG MatchIndexCount
  40. );
  41. NONVIRTUAL
  42. BOOLEAN
  43. RemoveAll(
  44. );
  45. NONVIRTUAL
  46. VOID
  47. RemoveLastEntry(
  48. ULONG HashValue,
  49. ULONG Index
  50. );
  51. NONVIRTUAL
  52. VOID
  53. DumpHashTable(
  54. );
  55. private:
  56. NONVIRTUAL
  57. VOID
  58. Construct (
  59. );
  60. NONVIRTUAL
  61. VOID
  62. Destroy(
  63. );
  64. PHASH_INDEX_ELEMENT _hashTable;
  65. USHORT _hash_table_size;
  66. USHORT _hash_table_mask;
  67. USHORT _hash_table_bits;
  68. USHORT _hash_element_increment;
  69. };
  70. #endif // HASH_INDEX_DEFN