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.

234 lines
5.9 KiB

  1. /*++
  2. Copyright (C) 1996-1999 Microsoft Corporation
  3. Module Name:
  4. cntrtree.h
  5. Abstract:
  6. Header for the counter hierarchy.
  7. --*/
  8. #ifndef _CNTRTREE_H_
  9. #define _CNTRTREE_H_
  10. #include "namenode.h"
  11. enum {
  12. MACHINE_NODE,
  13. OBJECT_NODE,
  14. INSTANCE_NODE,
  15. COUNTER_NODE,
  16. ITEM_NODE
  17. };
  18. //
  19. class CMachineNode;
  20. class CObjectNode;
  21. class CCounterNode;
  22. class CInstanceNode;
  23. class CReport;
  24. class CGraphItem;
  25. //
  26. // Class CCounterTree
  27. //
  28. class CCounterTree
  29. {
  30. friend CMachineNode;
  31. friend CInstanceNode;
  32. public:
  33. CCounterTree( void );
  34. HRESULT AddCounterItem( LPTSTR pszPath, CGraphItem* pItem, BOOL bMonitorDuplicateInstances );
  35. void RemoveCounterItem( CGraphItem* pItem );
  36. void RemoveMachine( CMachineNode *pMachine);
  37. HRESULT GetMachine( LPTSTR pszName, CMachineNode **pMachineRet );
  38. CMachineNode *FirstMachine( void ) { return (CMachineNode*)m_listMachines.First(); }
  39. CGraphItem* FirstCounter( void );
  40. INT NumCounters( void ) { return m_nItems; }
  41. private:
  42. CNamedNodeList m_listMachines;
  43. INT m_nItems;
  44. };
  45. typedef CCounterTree *PCCounterTree;
  46. //
  47. // Class CMachineNode
  48. //
  49. class CMachineNode : public CNamedNode
  50. {
  51. friend CCounterTree;
  52. friend CGraphItem;
  53. friend CReport;
  54. public:
  55. // void *operator new( size_t stBlock, LPTSTR pszName );
  56. #if _MSC_VER >= 1300
  57. void operator delete ( void *pObject );
  58. #endif
  59. void *operator new( size_t stBlock, UINT iLength);
  60. void operator delete ( void *pObject, UINT );
  61. CMachineNode( void ) { m_xWidth = -1; }
  62. HRESULT GetCounterObject(LPTSTR pszName, CObjectNode **ppObject);
  63. HRESULT AddObject(CObjectNode *pObject);
  64. void RemoveObject(CObjectNode *pObject);
  65. void DeleteNode (BOOL bPropagateUp);
  66. LPCTSTR Name( void ) {return m_szName;}
  67. CMachineNode *Next( void ) { return (CMachineNode*)m_pnodeNext; }
  68. CObjectNode *FirstObject( void ) { return (CObjectNode*)m_listObjects.First(); }
  69. private:
  70. PCCounterTree m_pCounterTree;
  71. CNamedNodeList m_listObjects;
  72. INT m_xWidth;
  73. INT m_yPos;
  74. TCHAR m_szName[1];
  75. };
  76. typedef CMachineNode *PCMachineNode;
  77. //
  78. // Class CObjectNode
  79. //
  80. class CObjectNode : public CNamedNode
  81. {
  82. friend CMachineNode;
  83. friend CGraphItem;
  84. friend CReport;
  85. public:
  86. // void *operator new( size_t stBlock, LPTSTR pszName );
  87. #if _MSC_VER >= 1300
  88. void operator delete ( void *pObject );
  89. #endif
  90. void *operator new( size_t stBlock, UINT iLength);
  91. void operator delete ( void *pObject, UINT );
  92. CObjectNode( void ) { m_xWidth = -1; }
  93. LPCTSTR Name() {return m_szName;}
  94. HRESULT GetCounter(LPTSTR pszName, CCounterNode **ppObject);
  95. HRESULT AddCounter(CCounterNode *pCounter);
  96. void RemoveCounter(CCounterNode *pCounter);
  97. void DeleteNode (BOOL bPropagateUp);
  98. HRESULT GetInstance(
  99. LPTSTR pszParent,
  100. LPTSTR pszName,
  101. DWORD dwIndex,
  102. BOOL bMonitorDuplicateInstances,
  103. CInstanceNode **ppObject );
  104. HRESULT AddInstance(CInstanceNode *pInstance);
  105. void RemoveInstance(CInstanceNode *pInstance);
  106. CObjectNode *Next( void ) { return (CObjectNode*)m_pnodeNext; }
  107. CInstanceNode *FirstInstance( void ) { return (CInstanceNode*)m_listInstances.First(); }
  108. CCounterNode *FirstCounter( void ) { return (CCounterNode*)m_listCounters.First(); }
  109. private:
  110. PCMachineNode m_pMachine;
  111. CNamedNodeList m_listCounters;
  112. CNamedNodeList m_listInstances;
  113. INT m_yPos;
  114. INT m_xWidth;
  115. TCHAR m_szName[1];
  116. };
  117. typedef CObjectNode *PCObjectNode;
  118. //
  119. // Class CInstanceNode
  120. //
  121. class CInstanceNode : public CNamedNode
  122. {
  123. friend CObjectNode;
  124. friend CGraphItem;
  125. friend CReport;
  126. private:
  127. PCObjectNode m_pObject;
  128. CGraphItem *m_pItems;
  129. INT m_xPos;
  130. INT m_xWidth;
  131. INT m_nParentLen;
  132. TCHAR m_szName[1];
  133. public:
  134. // void *operator new( size_t stBlock, LPTSTR pszName );
  135. #if _MSC_VER >= 1300
  136. void operator delete ( void *pObject );
  137. #endif
  138. void *operator new( size_t stBlock, UINT iLength);
  139. void operator delete ( void *pObject, UINT );
  140. CInstanceNode() { m_pItems = NULL; m_xWidth = -1;}
  141. LPCTSTR Name( void ) {return m_szName;}
  142. BOOL HasParent( void ) {return m_nParentLen; }
  143. INT GetParentName ( LPTSTR pszName );
  144. INT GetInstanceName ( LPTSTR pszName );
  145. HRESULT AddItem( CCounterNode *pCounter, CGraphItem* pItemNew );
  146. void RemoveItem( CGraphItem* pItem );
  147. void DeleteNode (BOOL bPropagateUp);
  148. CInstanceNode *Next( void ) { return (CInstanceNode*)m_pnodeNext; }
  149. CGraphItem *FirstItem( void ) { return m_pItems; }
  150. };
  151. typedef CInstanceNode *PCInstanceNode;
  152. //
  153. // Class CCounterNode
  154. //
  155. class CCounterNode : public CNamedNode
  156. {
  157. friend CObjectNode;
  158. friend CGraphItem;
  159. friend CReport;
  160. public:
  161. CGraphItem *m_pFirstGenerated;
  162. // void *operator new( size_t stBlock, LPTSTR pszName );
  163. #if _MSC_VER >= 1300
  164. void operator delete ( void *pObject );
  165. #endif
  166. void *operator new( size_t stBlock, UINT iLength);
  167. void operator delete ( void *pObject, UINT );
  168. CCounterNode( void ) { m_nCounterRef = 0;m_xWidth = -1;}
  169. void AddItem ( CGraphItem* ) { m_nCounterRef++; }
  170. void RemoveItem ( CGraphItem* ) { if (--m_nCounterRef == 0) m_pObject->RemoveCounter(this); }
  171. LPCTSTR Name( void ) {return m_szName;}
  172. CCounterNode *Next( void ) { return (CCounterNode*)m_pnodeNext; }
  173. void DeleteNode (BOOL bPropagateUp);
  174. private:
  175. PCObjectNode m_pObject;
  176. INT m_nCounterRef;
  177. INT m_yPos;
  178. INT m_xWidth;
  179. TCHAR m_szName[1];
  180. };
  181. typedef CCounterNode *PCCounterNode;
  182. #endif