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.

103 lines
3.8 KiB

  1. #ifndef _FIND_LIST_HPP_
  2. #define _FIND_LIST_HPP_
  3. // Ruler
  4. // 1 2 3 4 5 6 7 8
  5. //345678901234567890123456789012345678901234567890123456789012345678901234567890
  6. /********************************************************************/
  7. /* */
  8. /* The standard layout. */
  9. /* */
  10. /* The standard layout for 'hpp' files for this code is as */
  11. /* follows: */
  12. /* */
  13. /* 1. Include files. */
  14. /* 2. Constants exported from the class. */
  15. /* 3. Data structures exported from the class. */
  16. /* 4. Forward references to other data structures. */
  17. /* 5. Class specifications (including inline functions). */
  18. /* 6. Additional large inline functions. */
  19. /* */
  20. /* Any portion that is not required is simply omitted. */
  21. /* */
  22. /********************************************************************/
  23. #include "Global.hpp"
  24. #include "BucketList.hpp"
  25. /********************************************************************/
  26. /* */
  27. /* The find list. */
  28. /* */
  29. /* The find list links all the pages in the same hash bucket */
  30. /* together so that the correct page can be found. */
  31. /* */
  32. /********************************************************************/
  33. class FIND_LIST : public BUCKET_LIST
  34. {
  35. //
  36. // Private data.
  37. //
  38. LIST FindList;
  39. public:
  40. //
  41. // Public inline functions.
  42. //
  43. // All page descriptions contain three linked lists.
  44. // These lists are all derived from a common base
  45. // class. However, this class is unable to support
  46. // multiple instances in a single class a wrapper
  47. // has been created for each list to make it work
  48. // as required.
  49. //
  50. FIND_LIST( VOID )
  51. { /* void */ };
  52. INLINE VOID DeleteFromFindList( LIST *HeadOfList )
  53. { FindList.Delete( HeadOfList ); }
  54. INLINE BOOLEAN EndOfFindList( VOID )
  55. { return (this == NULL); }
  56. STATIC INLINE PAGE *FirstInFindList( LIST *HeadOfList )
  57. { return ComputePageAddress( ((CHAR*) HeadOfList -> First()) ); }
  58. INLINE VOID InsertInFindList( LIST *HeadOfList )
  59. { FindList.Insert( HeadOfList ); }
  60. INLINE PAGE *NextInFindList( VOID )
  61. { return ComputePageAddress( ((CHAR*) FindList.Next()) ); }
  62. ~FIND_LIST( VOID )
  63. { /* void */ };
  64. private:
  65. //
  66. // Private functions.
  67. //
  68. // Compute the actual start address of the page
  69. // and return it to allow the linked list to
  70. // be correctly walked.
  71. //
  72. STATIC INLINE PAGE *ComputePageAddress( CHAR *Address )
  73. {
  74. if ( Address != NULL )
  75. { return ((PAGE*) (Address - sizeof(BUCKET_LIST))); }
  76. else
  77. { return ((PAGE*) NULL); }
  78. }
  79. //
  80. // Disabled operations.
  81. //
  82. // All copy constructors and class assignment
  83. // operations are disabled.
  84. //
  85. FIND_LIST( CONST FIND_LIST & Copy );
  86. VOID operator=( CONST FIND_LIST & Copy );
  87. };
  88. #endif