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.

203 lines
3.5 KiB

  1. // (C) 1999-2001 Microsoft Corporation
  2. #ifndef WMI_TREE
  3. #define WMI_TREE
  4. /******************************************************************************
  5. *
  6. * Name:
  7. *
  8. *
  9. * Description:
  10. *
  11. *
  12. *****************************************************************************/
  13. typedef DWORD TypeId_TreeNode ;
  14. /******************************************************************************
  15. *
  16. * Name:
  17. *
  18. *
  19. * Description:
  20. *
  21. *
  22. *****************************************************************************/
  23. class DllImportExport WmiTreeNode
  24. {
  25. protected:
  26. TypeId_TreeNode m_Type ;
  27. void *m_Data ;
  28. WmiTreeNode *m_Left ;
  29. WmiTreeNode *m_Right ;
  30. WmiTreeNode *m_Parent ;
  31. public:
  32. WmiTreeNode (
  33. WmiTreeNode *a_Node
  34. )
  35. {
  36. m_Type = a_Node->m_Type ;
  37. m_Data = a_Node->m_Data ;
  38. m_Left = a_Node->m_Left ;
  39. m_Right = a_Node->m_Right ;
  40. m_Parent = a_Node->m_Parent ;
  41. }
  42. WmiTreeNode (
  43. TypeId_TreeNode a_Type = 0 ,
  44. void *a_Data = NULL ,
  45. WmiTreeNode *a_Left = NULL ,
  46. WmiTreeNode *a_Right = NULL ,
  47. WmiTreeNode *a_Parent = NULL
  48. )
  49. {
  50. m_Type = a_Type ;
  51. m_Parent = a_Parent ;
  52. m_Data = a_Data ;
  53. m_Left = a_Left ;
  54. m_Right = a_Right ;
  55. if ( m_Left )
  56. m_Left->SetParent ( this ) ;
  57. if ( m_Right )
  58. m_Right->SetParent ( this ) ;
  59. }
  60. virtual ~WmiTreeNode () {}
  61. TypeId_TreeNode GetType ()
  62. {
  63. return m_Type ;
  64. }
  65. void *GetData ()
  66. {
  67. return m_Data ;
  68. }
  69. WmiTreeNode *GetLeft ()
  70. {
  71. return m_Left ;
  72. }
  73. WmiTreeNode *GetRight ()
  74. {
  75. return m_Right ;
  76. }
  77. WmiTreeNode *GetParent ()
  78. {
  79. return m_Parent ;
  80. }
  81. void GetData ( void **a_Data )
  82. {
  83. *a_Data = & m_Data ;
  84. }
  85. void GetLeft ( WmiTreeNode **&a_Left )
  86. {
  87. a_Left = &m_Left ;
  88. }
  89. void GetRight ( WmiTreeNode **&a_Right )
  90. {
  91. a_Right = &m_Right ;
  92. }
  93. void GetParent ( WmiTreeNode **&a_Parent )
  94. {
  95. a_Parent = &m_Parent ;
  96. }
  97. void SetType ( TypeId_TreeNode a_Type )
  98. {
  99. m_Type = a_Type ;
  100. }
  101. void *SetData ( void *a_Data )
  102. {
  103. void *t_Data = m_Data ;
  104. m_Data = a_Data ;
  105. return t_Data ;
  106. }
  107. WmiTreeNode *SetLeft ( WmiTreeNode *a_Left )
  108. {
  109. WmiTreeNode *t_Left = m_Left ;
  110. m_Left = a_Left ;
  111. return t_Left ;
  112. }
  113. WmiTreeNode *SetRight ( WmiTreeNode *a_Right )
  114. {
  115. WmiTreeNode *t_Right = m_Right ;
  116. m_Right = a_Right ;
  117. return t_Right ;
  118. }
  119. WmiTreeNode *SetParent ( WmiTreeNode *a_Parent )
  120. {
  121. WmiTreeNode *t_Parent = m_Parent ;
  122. m_Parent = a_Parent ;
  123. return t_Parent ;
  124. }
  125. virtual WmiTreeNode *Copy () ; // Copy node, not allocating copies of data and allocating copies of sub tree
  126. virtual WmiTreeNode *CopyNode () ; // Copy node, not allocating copies of data and subtree
  127. virtual void Print () {} ;
  128. } ;
  129. class DllImportExport WmiTreeNodeIterator
  130. {
  131. protected:
  132. WmiTreeNode *m_Iterator ;
  133. public:
  134. WmiTreeNodeIterator ( WmiTreeNodeIterator *a_WmiTreeNodeIterator )
  135. {
  136. m_Iterator = a_WmiTreeNodeIterator->m_Iterator ;
  137. }
  138. WmiTreeNodeIterator ( WmiTreeNode *a_Root )
  139. {
  140. m_Iterator = a_Root ;
  141. }
  142. virtual ~WmiTreeNodeIterator () {}
  143. WmiTreeNode *GetIterator ()
  144. {
  145. return m_Iterator ;
  146. }
  147. WmiTreeNode *SetIterator ( WmiTreeNode *a_Iterator )
  148. {
  149. WmiTreeNode *t_Iterator = m_Iterator ;
  150. m_Iterator = a_Iterator ;
  151. return t_Iterator ;
  152. }
  153. virtual WmiTreeNodeIterator *Copy ()
  154. {
  155. WmiTreeNodeIterator *t_Iterator = new WmiTreeNodeIterator ( m_Iterator ) ;
  156. return t_Iterator ;
  157. }
  158. void InOrder () ;
  159. void PreOrder () ;
  160. void PostOrder () ;
  161. } ;
  162. #endif // WMI_TREE