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.

111 lines
4.5 KiB

  1. #ifndef _BUCKET_LIST_HPP_
  2. #define _BUCKET_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 "List.hpp"
  25. /********************************************************************/
  26. /* */
  27. /* Class forward references. */
  28. /* */
  29. /* We need to refer to the following classes before they are */
  30. /* fully specified so here we list them as forward references. */
  31. /* */
  32. /********************************************************************/
  33. class PAGE;
  34. /********************************************************************/
  35. /* */
  36. /* The bucket list. */
  37. /* */
  38. /* All allocation buckets have a linked list of pages with */
  39. /* available space in ascending order of address. */
  40. /* */
  41. /********************************************************************/
  42. class BUCKET_LIST
  43. {
  44. //
  45. // Private data.
  46. //
  47. LIST BucketList;
  48. public:
  49. //
  50. // Public inline functions.
  51. //
  52. // All page descriptions contain four linked lists.
  53. // These lists are all derived from a common base
  54. // class. However, this class is unable to support
  55. // multiple instances in a single class a wrapper
  56. // has been created for each list to make it work
  57. // as required.
  58. //
  59. BUCKET_LIST( VOID )
  60. { /* void */ };
  61. INLINE VOID DeleteFromBucketList( LIST *HeadOfList )
  62. { BucketList.Delete( HeadOfList ); }
  63. INLINE BOOLEAN EndOfBucketList( VOID )
  64. { return (this == NULL); }
  65. STATIC INLINE PAGE *FirstInBucketList( LIST *HeadOfList )
  66. { return ((PAGE*) HeadOfList -> First()); }
  67. INLINE VOID InsertInBucketList( LIST *HeadOfList )
  68. { BucketList.Insert( HeadOfList ); }
  69. INLINE VOID InsertAfterInBucketList( LIST *HeadOfList,PAGE *Page )
  70. { BucketList.InsertAfter( HeadOfList,(LIST*) Page ); }
  71. INLINE VOID InsertBeforeInBucketList( LIST *HeadOfList,PAGE *Page )
  72. { BucketList.InsertBefore( HeadOfList,(LIST*) Page ); }
  73. STATIC INLINE PAGE *LastInBucketList( LIST *HeadOfList )
  74. { return ((PAGE*) HeadOfList -> Last()); }
  75. INLINE PAGE *NextInBucketList( VOID )
  76. { return ((PAGE*) BucketList.Next()); }
  77. INLINE PAGE *PreviousInBucketList( VOID )
  78. { return ((PAGE*) BucketList.Previous()); }
  79. ~BUCKET_LIST( VOID )
  80. { /* void */ };
  81. private:
  82. //
  83. // Disabled operations.
  84. //
  85. // All copy constructors and class assignment
  86. // operations are disabled.
  87. //
  88. BUCKET_LIST( CONST BUCKET_LIST & Copy );
  89. VOID operator=( CONST BUCKET_LIST & Copy );
  90. };
  91. #endif