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.

126 lines
3.0 KiB

  1. //+--------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1992.
  5. //
  6. // File: dblink.hxx
  7. //
  8. // Contents: Doubly-linked list element
  9. //
  10. // Classes: CDlElement
  11. //
  12. // History: 28-Jul-92 DrewB Created
  13. //
  14. //---------------------------------------------------------------
  15. #ifndef __DBLINK_HXX__
  16. #define __DBLINK_HXX__
  17. class CDlElement;
  18. SAFE_DFBASED_PTR(CBasedDlElementPtr, CDlElement);
  19. //+--------------------------------------------------------------
  20. //
  21. // Class: CDlElement (dle)
  22. //
  23. // Purpose: An element of a doubly-linked list
  24. //
  25. // Interface: See below
  26. //
  27. // History: 28-Jul-92 DrewB Created
  28. //
  29. //---------------------------------------------------------------
  30. class CDlElement
  31. {
  32. public:
  33. inline CDlElement(void);
  34. inline CDlElement *_GetNext(void) const;
  35. inline void SetNext(CDlElement *pdle);
  36. inline CDlElement *_GetPrev(void) const;
  37. inline void SetPrev(CDlElement *pdle);
  38. protected:
  39. CBasedDlElementPtr _pdlePrev, _pdleNext;
  40. };
  41. //+--------------------------------------------------------------
  42. //
  43. // Member: CDlElement::CDlElement, public
  44. //
  45. // Synopsis: Ctor
  46. //
  47. // History: 28-Jul-92 DrewB Created
  48. //
  49. //---------------------------------------------------------------
  50. inline CDlElement::CDlElement(void)
  51. {
  52. _pdlePrev = _pdleNext = NULL;
  53. }
  54. //+--------------------------------------------------------------
  55. //
  56. // Member: CDlElement::_GetNext, public
  57. //
  58. // Synopsis: Returns _pdleNext
  59. //
  60. // History: 28-Jul-92 DrewB Created
  61. //
  62. //---------------------------------------------------------------
  63. inline CDlElement *CDlElement::_GetNext(void) const
  64. {
  65. return BP_TO_P(CDlElement *, _pdleNext);
  66. }
  67. //+--------------------------------------------------------------
  68. //
  69. // Member: CDlElement::_SetNext, public
  70. //
  71. // Synopsis: Sets _pdleNext
  72. //
  73. // History: 28-Jul-92 DrewB Created
  74. //
  75. //---------------------------------------------------------------
  76. inline void CDlElement::SetNext(CDlElement *pdle)
  77. {
  78. _pdleNext = P_TO_BP(CBasedDlElementPtr, pdle);
  79. }
  80. //+--------------------------------------------------------------
  81. //
  82. // Member: CDlElement::_GetPrev, public
  83. //
  84. // Synopsis: Returns _pdlePrev
  85. //
  86. // History: 28-Jul-92 DrewB Created
  87. //
  88. //---------------------------------------------------------------
  89. inline CDlElement *CDlElement::_GetPrev(void) const
  90. {
  91. return BP_TO_P(CDlElement *, _pdlePrev);
  92. }
  93. //+--------------------------------------------------------------
  94. //
  95. // Member: CDlElement::_SetPrev, public
  96. //
  97. // Synopsis: Sets _pdlePrev
  98. //
  99. // History: 28-Jul-92 DrewB Created
  100. //
  101. //---------------------------------------------------------------
  102. inline void CDlElement::SetPrev(CDlElement *pdle)
  103. {
  104. _pdlePrev = P_TO_BP(CBasedDlElementPtr, pdle);
  105. }
  106. #define DECLARE_DBLINK(type) \
  107. type *GetNext(void) const { return (type *)_GetNext(); } \
  108. type *GetPrev(void) const { return (type *)_GetPrev(); } \
  109. #endif // #ifndef __DBLINK_HXX__