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.

243 lines
6.0 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( LPWSTR pszPath, CGraphItem* pItem, BOOL bMonitorDuplicateInstances );
  35. void RemoveCounterItem( CGraphItem* pItem );
  36. void RemoveMachine( CMachineNode *pMachine);
  37. HRESULT GetMachine( LPWSTR pszName, CMachineNode **pMachineRet );
  38. CMachineNode *FirstMachine( void ) { return (CMachineNode*)m_listMachines.First(); }
  39. CGraphItem* FirstCounter( void );
  40. INT NumCounters( void ) { return m_nItems; }
  41. HRESULT IndexFromCounter( const CGraphItem* pItem, INT* pIndex );
  42. private:
  43. CNamedNodeList m_listMachines;
  44. INT m_nItems;
  45. };
  46. typedef CCounterTree *PCCounterTree;
  47. //
  48. // Class CMachineNode
  49. //
  50. class CMachineNode : public CNamedNode
  51. {
  52. friend CCounterTree;
  53. friend CGraphItem;
  54. friend CReport;
  55. public:
  56. // void *operator new( size_t stBlock, LPWSTR pszName );
  57. #if _MSC_VER >= 1300
  58. void operator delete ( void *pObject );
  59. #endif
  60. void *operator new( size_t stBlock, UINT iLength);
  61. void operator delete ( void *pObject, UINT );
  62. CMachineNode( void ) { m_xWidth = -1; }
  63. HRESULT GetCounterObject(LPWSTR pszName, CObjectNode **ppObject);
  64. HRESULT AddObject(CObjectNode *pObject);
  65. void RemoveObject(CObjectNode *pObject);
  66. void DeleteNode (BOOL bPropagateUp);
  67. LPCWSTR Name( void ) {return m_szName;}
  68. CMachineNode *Next( void ) { return (CMachineNode*)m_pnodeNext; }
  69. CObjectNode *FirstObject( void ) { return (CObjectNode*)m_listObjects.First(); }
  70. private:
  71. PCCounterTree m_pCounterTree;
  72. CNamedNodeList m_listObjects;
  73. INT m_xWidth;
  74. INT m_yPos;
  75. WCHAR m_szName[1];
  76. };
  77. typedef CMachineNode *PCMachineNode;
  78. //
  79. // Class CObjectNode
  80. //
  81. class CObjectNode : public CNamedNode
  82. {
  83. friend CMachineNode;
  84. friend CGraphItem;
  85. friend CReport;
  86. public:
  87. // void *operator new( size_t stBlock, LPWSTR pszName );
  88. #if _MSC_VER >= 1300
  89. void operator delete ( void *pObject );
  90. #endif
  91. void *operator new( size_t stBlock, UINT iLength);
  92. void operator delete ( void *pObject, UINT );
  93. CObjectNode( void ) { m_xWidth = -1; }
  94. LPCWSTR Name() {return m_szName;}
  95. HRESULT GetCounter(LPWSTR pszName, CCounterNode **ppObject);
  96. HRESULT AddCounter(CCounterNode *pCounter);
  97. void RemoveCounter(CCounterNode *pCounter);
  98. void DeleteNode (BOOL bPropagateUp);
  99. HRESULT GetInstance(
  100. LPWSTR pszParent,
  101. LPWSTR pszName,
  102. DWORD dwIndex,
  103. BOOL bMonitorDuplicateInstances,
  104. CInstanceNode **ppObject );
  105. HRESULT AddInstance(CInstanceNode *pInstance);
  106. void RemoveInstance(CInstanceNode *pInstance);
  107. CObjectNode *Next( void ) { return (CObjectNode*)m_pnodeNext; }
  108. CInstanceNode *FirstInstance( void ) { return (CInstanceNode*)m_listInstances.First(); }
  109. CCounterNode *FirstCounter( void ) { return (CCounterNode*)m_listCounters.First(); }
  110. private:
  111. PCMachineNode m_pMachine;
  112. CNamedNodeList m_listCounters;
  113. CNamedNodeList m_listInstances;
  114. INT m_yPos;
  115. INT m_xWidth;
  116. WCHAR m_szName[1];
  117. };
  118. typedef CObjectNode *PCObjectNode;
  119. //
  120. // Class CInstanceNode
  121. //
  122. class CInstanceNode : public CNamedNode
  123. {
  124. friend CObjectNode;
  125. friend CGraphItem;
  126. friend CReport;
  127. private:
  128. PCObjectNode m_pObject;
  129. CGraphItem *m_pItems;
  130. INT m_xPos;
  131. INT m_xWidth;
  132. INT m_nParentLen;
  133. LPWSTR m_pCachedParentName;
  134. LPWSTR m_pCachedInstName;
  135. WCHAR m_szName[1];
  136. public:
  137. // void *operator new( size_t stBlock, LPWSTR pszName );
  138. #if _MSC_VER >= 1300
  139. void operator delete ( void *pObject );
  140. #endif
  141. void *operator new( size_t stBlock, UINT iLength);
  142. void operator delete ( void *pObject, UINT );
  143. CInstanceNode()
  144. {
  145. m_pItems = NULL;
  146. m_xWidth = -1;
  147. m_pCachedParentName = NULL;
  148. m_pCachedInstName = NULL;
  149. }
  150. LPCWSTR Name( void ) {return m_szName;}
  151. BOOL HasParent( void ) {return m_nParentLen; }
  152. LPWSTR GetParentName ();
  153. LPWSTR GetInstanceName();
  154. HRESULT AddItem( CCounterNode *pCounter, CGraphItem* pItemNew );
  155. void RemoveItem( CGraphItem* pItem );
  156. void DeleteNode (BOOL bPropagateUp);
  157. CInstanceNode *Next( void ) { return (CInstanceNode*)m_pnodeNext; }
  158. CGraphItem *FirstItem( void ) { return m_pItems; }
  159. };
  160. typedef CInstanceNode *PCInstanceNode;
  161. //
  162. // Class CCounterNode
  163. //
  164. class CCounterNode : public CNamedNode
  165. {
  166. friend CObjectNode;
  167. friend CGraphItem;
  168. friend CReport;
  169. public:
  170. CGraphItem *m_pFirstGenerated;
  171. // void *operator new( size_t stBlock, LPWSTR pszName );
  172. #if _MSC_VER >= 1300
  173. void operator delete ( void *pObject );
  174. #endif
  175. void *operator new( size_t stBlock, UINT iLength);
  176. void operator delete ( void *pObject, UINT );
  177. CCounterNode( void ) { m_nCounterRef = 0;m_xWidth = -1;}
  178. void AddItem ( CGraphItem* ) { m_nCounterRef++; }
  179. void RemoveItem ( CGraphItem* ) { if (--m_nCounterRef == 0) m_pObject->RemoveCounter(this); }
  180. LPCWSTR Name( void ) {return m_szName;}
  181. CCounterNode *Next( void ) { return (CCounterNode*)m_pnodeNext; }
  182. void DeleteNode (BOOL bPropagateUp);
  183. private:
  184. PCObjectNode m_pObject;
  185. INT m_nCounterRef;
  186. INT m_yPos;
  187. INT m_xWidth;
  188. WCHAR m_szName[1];
  189. };
  190. typedef CCounterNode *PCCounterNode;
  191. #endif