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.

149 lines
2.3 KiB

  1. /*++
  2. Copyright (c) 1990 Microsoft Corporation
  3. Module Name:
  4. sortlist.hxx
  5. Abstract:
  6. This module contains the declaration for the SORTED_LIST class.
  7. SORTED_LIST is a concrete implementation of a SORTABLE_CONTAINER.
  8. The elements in a SORTED_LIST are maintained in sorted order.
  9. Environment:
  10. ULIB, User Mode
  11. --*/
  12. #if ! defined( _SORTED_LIST_ )
  13. #define _SORTED_LIST_
  14. #include "sortcnt.hxx"
  15. #include "array.hxx"
  16. DECLARE_CLASS( SORTED_LIST );
  17. class SORTED_LIST : public SORTABLE_CONTAINER {
  18. friend class SORTED_LIST_ITERATOR;
  19. public:
  20. ULIB_EXPORT
  21. DECLARE_CONSTRUCTOR( SORTED_LIST );
  22. DECLARE_CAST_MEMBER_FUNCTION( SORTED_LIST );
  23. VIRTUAL
  24. ULIB_EXPORT
  25. ~SORTED_LIST (
  26. );
  27. NONVIRTUAL
  28. ULIB_EXPORT
  29. BOOLEAN
  30. Initialize (
  31. IN BOOLEAN Ascending DEFAULT TRUE
  32. );
  33. NONVIRTUAL
  34. BOOLEAN
  35. IsAscending (
  36. );
  37. VIRTUAL
  38. ULIB_EXPORT
  39. BOOLEAN
  40. DeleteAllMembers(
  41. );
  42. VIRTUAL
  43. ULIB_EXPORT
  44. BOOLEAN
  45. Put (
  46. IN OUT POBJECT Member
  47. );
  48. VIRTUAL
  49. ULIB_EXPORT
  50. PITERATOR
  51. QueryIterator (
  52. ) CONST;
  53. VIRTUAL
  54. ULIB_EXPORT
  55. ULONG
  56. QueryMemberCount (
  57. ) CONST;
  58. VIRTUAL
  59. POBJECT
  60. Remove (
  61. IN OUT PITERATOR Position
  62. );
  63. VIRTUAL
  64. BOOLEAN
  65. Sort(
  66. IN BOOLEAN Ascending DEFAULT TRUE
  67. );
  68. protected:
  69. NONVIRTUAL
  70. VOID
  71. Construct (
  72. );
  73. VIRTUAL
  74. ULONG
  75. Search(
  76. IN PCOBJECT Key,
  77. IN ULONG FirstIndex,
  78. IN ULONG LastIndex
  79. );
  80. private:
  81. ARRAY _Array; // Array
  82. BOOLEAN _Ascending; // Ascending flag
  83. #if DBG==1
  84. ULONG _IteratorCount; // Iterator Count
  85. #endif
  86. };
  87. INLINE
  88. BOOLEAN
  89. SORTED_LIST::IsAscending (
  90. )
  91. /*++
  92. Routine Description:
  93. Determines if the list is sorted in ascending order
  94. Arguments:
  95. None
  96. Return Value:
  97. BOOLEAN - TRUE if list is sorted in ascending order, FALSE otherwise
  98. --*/
  99. {
  100. return _Ascending;
  101. }
  102. #endif // _SORTED_LIST_