Source code of Windows XP (NT5)
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.

156 lines
3.5 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1992.
  5. //
  6. // File: vect.hxx
  7. //
  8. // Contents: Vector common types
  9. //
  10. // Classes: CVectBits -- Bit fields for vectors
  11. //
  12. // History: 06-Aug-92 PhilipLa Created.
  13. //
  14. //--------------------------------------------------------------------------
  15. #ifndef __VECT_HXX__
  16. #define __VECT_HXX__
  17. #include <page.hxx>
  18. //+-------------------------------------------------------------------------
  19. //
  20. // Class: CVectBits (vb)
  21. //
  22. // Purpose: Structure for Vector flags.
  23. //
  24. // Interface:
  25. //
  26. // History: 06-Aug-92 PhilipLa Created.
  27. //
  28. // Notes:
  29. //
  30. //--------------------------------------------------------------------------
  31. struct CVectBits
  32. {
  33. USHORT full:1;
  34. USHORT firstfree;
  35. };
  36. SAFE_DFBASED_PTR(CBasedVectBitsPtr, CVectBits);
  37. //+-------------------------------------------------------------------------
  38. //
  39. // Class: CPagedVector (pv)
  40. //
  41. // Purpose: *Finish This*
  42. //
  43. // Interface:
  44. //
  45. // History: 27-Sep-92 PhilipLa Created.
  46. //
  47. // Notes:
  48. //
  49. //--------------------------------------------------------------------------
  50. class CPagedVector
  51. {
  52. public:
  53. inline CPagedVector(const SID sid);
  54. SCODE Init(CMStream *pms, ULONG ulSize);
  55. void InitCopy(CPagedVector *pvectOld);
  56. ~CPagedVector();
  57. void Empty(void);
  58. SCODE Resize(ULONG ulSize);
  59. SCODE Flush(void);
  60. SCODE GetTableWithSect(
  61. const ULONG iTable,
  62. DWORD dwFlags,
  63. SECT sectKnown,
  64. void **ppmp);
  65. inline SCODE GetTable(const ULONG iTable, DWORD dwFlags, void **ppmp);
  66. inline void ReleaseTable(const ULONG iTable);
  67. inline void SetSect(const ULONG iTable, const SECT sect);
  68. inline CVectBits * GetBits(const ULONG iTable);
  69. inline void ResetBits(void);
  70. SCODE SetDirty(ULONG iTable);
  71. inline void ResetDirty(ULONG iTable);
  72. inline void FreeTable(ULONG iTable);
  73. inline CMStream * GetParent(void) const;
  74. inline void SetParent(CMStream *pms);
  75. private:
  76. inline CVectBits * GetNewVectBits(ULONG ulSize);
  77. inline CBasedMSFPagePtr * GetNewPageArray(ULONG ulSize);
  78. CBasedMSFPageTablePtr _pmpt;
  79. const SID _sid;
  80. ULONG _ulSize; // Amount in use
  81. ULONG _ulAllocSize; // Amount allocated
  82. CBasedMStreamPtr _pmsParent;
  83. CBasedMSFPagePtrPtr _amp;
  84. CBasedVectBitsPtr _avb;
  85. };
  86. //+---------------------------------------------------------------------------
  87. //
  88. // Member: CPagedVector::CPagedVector, public
  89. //
  90. // Synopsis: constructor
  91. //
  92. // History: 28-Jun-94 PhilipLa Created
  93. //
  94. //----------------------------------------------------------------------------
  95. inline CPagedVector::CPagedVector(const SID sid)
  96. : _sid(sid),
  97. _pmpt(NULL),
  98. _amp(NULL),
  99. _avb(NULL),
  100. _pmsParent(NULL)
  101. {
  102. _ulSize = 0;
  103. _ulAllocSize = 0;
  104. }
  105. //+---------------------------------------------------------------------------
  106. //
  107. // Member: CPagedVector::GetTable, public
  108. //
  109. // Synopsis: Inline function - calls through to GetTableWithSect,
  110. // passing a sect that indicates we don't know the
  111. // location of the page.
  112. //
  113. // History: 28-Jun-94 PhilipLa Created
  114. //
  115. //----------------------------------------------------------------------------
  116. inline SCODE CPagedVector::GetTable(
  117. const ULONG iTable,
  118. DWORD dwFlags,
  119. void **ppmp)
  120. {
  121. return GetTableWithSect(iTable, dwFlags, ENDOFCHAIN, ppmp);
  122. }
  123. #endif //__VECT_HXX__