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.

148 lines
3.7 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1991 - 1992.
  5. //
  6. // File: PRTIFLST.HXX
  7. //
  8. // Contents: Partition Information List
  9. //
  10. // Classes: CPartInfoList
  11. // CPartInfo
  12. //
  13. // History: 16-Feb-94 SrikantS Created
  14. //
  15. //----------------------------------------------------------------------------
  16. #pragma once
  17. //+---------------------------------------------------------------------------
  18. //
  19. // Class: CPartInfo
  20. //
  21. // Purpose: Object holding information pertaining to a CI partition.
  22. // This information is loaded from the index table.
  23. //
  24. // History: 2-16-94 srikants Created
  25. //
  26. // Notes:
  27. //
  28. //----------------------------------------------------------------------------
  29. class CPartInfo : public CDoubleLink
  30. {
  31. public:
  32. CPartInfo(PARTITIONID partId );
  33. PARTITIONID GetPartId() { return _partId; }
  34. WORKID GetChangeLogObjectId() { return _widChangeLog; }
  35. WORKID GetCurrMasterIndex() { return _widCurrMasterIndex; }
  36. WORKID GetNewMasterIndex() { return _widNewMasterIndex; }
  37. WORKID GetMMergeLog() { return _widMMergeLog; }
  38. void SetChangeLogObjectId( WORKID wid ) { _widChangeLog = wid; }
  39. void SetCurrMasterIndex( WORKID wid ) { _widCurrMasterIndex = wid; }
  40. void SetNewMasterIndex( WORKID wid ) { _widNewMasterIndex = wid; }
  41. void SetMMergeLog( WORKID wid ) { _widMMergeLog = wid; }
  42. private:
  43. PARTITIONID _partId;
  44. WORKID _widChangeLog;
  45. WORKID _widCurrMasterIndex;
  46. WORKID _widNewMasterIndex;
  47. WORKID _widMMergeLog;
  48. };
  49. //+---------------------------------------------------------------------------
  50. //
  51. // Class: CPartInfoList
  52. //
  53. // Purpose: A list of CPartInfo structures.
  54. //
  55. // History: 2-16-94 srikants Created
  56. //
  57. // Notes:
  58. //
  59. //----------------------------------------------------------------------------
  60. class CPartInfoList : public CDoubleList
  61. {
  62. friend class CForPartInfoIter;
  63. public:
  64. CPartInfoList(): _count(0) {}
  65. ~CPartInfoList();
  66. ULONG Count() const { return _count; }
  67. void Append( CPartInfo* p ) { _Queue(p); _count++; }
  68. CPartInfo * GetFirst() { return (CPartInfo *) _Top(); }
  69. CPartInfo * GetPartInfo( PARTITIONID partId );
  70. inline CPartInfo * RemoveFirst();
  71. private:
  72. ULONG _count;
  73. };
  74. class SPartInfoList : INHERIT_UNWIND
  75. {
  76. DECLARE_UNWIND
  77. public:
  78. SPartInfoList( CPartInfoList * pList ) : _pList(pList)
  79. { END_CONSTRUCTION( SPartInfoList ) ; }
  80. ~SPartInfoList() { delete _pList; }
  81. CPartInfoList * operator->() { return _pList; }
  82. CPartInfoList & operator* () { return *_pList; }
  83. CPartInfoList * Acquire()
  84. { CPartInfoList * temp = _pList; _pList = 0; return temp; }
  85. private:
  86. CPartInfoList * _pList;
  87. };
  88. //+---------------------------------------------------------------------------
  89. //
  90. // Class: CForPartInfoIter
  91. //
  92. // Purpose: Forward iterator for the CPartInfoList
  93. //
  94. // History: 2-16-94 srikants Created
  95. //
  96. // Notes:
  97. //
  98. //----------------------------------------------------------------------------
  99. class CForPartInfoIter : public CForwardIter
  100. {
  101. public:
  102. CForPartInfoIter ( CPartInfoList& list ) : CForwardIter(list) {}
  103. CPartInfo* operator->() { return (CPartInfo *) _pLinkCur; }
  104. CPartInfo* GetPartInfo() { return (CPartInfo *) _pLinkCur; }
  105. };
  106. inline CPartInfo* CPartInfoList::RemoveFirst()
  107. {
  108. ciDebugOut (( DEB_ITRACE, "CPartInfoList::RemoveFirst\n" ));
  109. CPartInfo* pPartInfo = (CPartInfo*) _Pop();
  110. if ( pPartInfo )
  111. _count--;
  112. return pPartInfo;
  113. }