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
1.5 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1992 - 1999
  6. //
  7. // File: queue.hxx
  8. //
  9. //--------------------------------------------------------------------------
  10. /*++
  11. --*/
  12. #ifndef __QUEUE_HXX__
  13. #define __QUEUE_HXX__
  14. #define INITIALQUEUESLOTS 4
  15. typedef struct
  16. {
  17. void * Buffer;
  18. unsigned int BufferLength;
  19. } QUEUE_ITEM;
  20. class QUEUE
  21. {
  22. private:
  23. QUEUE_ITEM * QueueSlots;
  24. int NumberOfQueueSlots;
  25. int EndOfQueue;
  26. QUEUE_ITEM InitialQueueSlots[INITIALQUEUESLOTS];
  27. public:
  28. QUEUE (
  29. );
  30. ~QUEUE (
  31. );
  32. int
  33. PutOnQueue (
  34. IN void * Item,
  35. IN unsigned int Length
  36. );
  37. int
  38. PutOnFrontOfQueue (
  39. IN void * Item,
  40. IN unsigned int Length
  41. );
  42. void *
  43. TakeOffQueue (
  44. OUT unsigned int * Length
  45. );
  46. void *
  47. TakeOffEndOfQueue (
  48. OUT unsigned int * Length
  49. );
  50. int
  51. FindAndTakeOffQueue (
  52. IN void * Item
  53. );
  54. int
  55. IsQueueEmpty (
  56. )
  57. {
  58. return(!(EndOfQueue));
  59. }
  60. int
  61. Size (
  62. )
  63. {
  64. return EndOfQueue;
  65. }
  66. int
  67. MergeWithQueue (
  68. IN QUEUE *SourceQueue
  69. );
  70. int
  71. MergeWithQueueInFront (
  72. IN QUEUE *SourceQueue
  73. );
  74. };
  75. #endif // __QUEUE_HXX__