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.

129 lines
3.2 KiB

  1. /*++
  2. Copyright (C) 2000-2001 Microsoft Corporation
  3. Module Name:
  4. WMIObjCooker.h
  5. Abstract:
  6. The implementation of per object cooking
  7. History:
  8. a-dcrews 01-Mar-00 Created
  9. --*/
  10. #ifndef _WMIOBJCOOKER_H_
  11. #define _WMIOBJCOOKER_H_
  12. #include <wbemint.h>
  13. #include <wstlallc.h>
  14. #include "CookerUtils.h"
  15. #include "Cache.h"
  16. #define WMI_DEFAULT_SAMPLE_WINDOW 2
  17. //
  18. //
  19. //
  20. //
  21. //////////////////////////////////////////////////////////////////
  22. WMISTATUS GetPropValue( CProperty* pProp, IWbemObjectAccess* pInstance, __int64* pnResult );
  23. //////////////////////////////////////////////////////////////////
  24. //
  25. // CWMISimpleObjectCooker
  26. //
  27. //////////////////////////////////////////////////////////////////
  28. class CWMISimpleObjectCooker : public IWMISimpleObjectCooker
  29. {
  30. long m_lRef; // Reference Counter
  31. HRESULT m_InitHR; // to hold the failure within the constructor
  32. IWbemObjectAccess* m_pCookingClass; // The cooking class
  33. WCHAR* m_wszClassName; // The cooking class' name
  34. IWbemServices * m_pNamespace;
  35. // Instance Management
  36. // ===================
  37. DWORD m_NumInst;
  38. IdCache<CCookingInstance *> m_InstanceCache; // The cooking instance cache
  39. // Cooking Property Definition Management
  40. // ======================================
  41. std::vector<CCookingProperty*, wbem_allocator<CCookingProperty*> > m_apPropertyCache;
  42. DWORD m_dwPropertyCacheSize;
  43. DWORD m_dwNumProperties; // The number of properties
  44. // Private Methods
  45. // ===============
  46. WMISTATUS GetData( CCookingProperty* pProperty,
  47. __int64** panRawCounter,
  48. __int64** panRawBase,
  49. __int64** panRawTimeStamp,
  50. DWORD* pdwNumEls );
  51. WMISTATUS UpdateSamples( CCookingInstance* pCookedInstance,DWORD dwRefreshStamp);
  52. WMISTATUS CookInstance( CCookingInstance* pCookingRecord, DWORD dwRefreshStamp);
  53. public:
  54. CWMISimpleObjectCooker();
  55. CWMISimpleObjectCooker( WCHAR* wszCookingClassName,
  56. IWbemObjectAccess* pCookingClass,
  57. IWbemObjectAccess* pRawClass,
  58. IWbemServices * pNamespace = NULL);
  59. virtual ~CWMISimpleObjectCooker();
  60. WCHAR* GetCookingClassName(){ return m_wszClassName; }
  61. HRESULT GetLastHR(){ return m_InitHR; }
  62. WMISTATUS SetProperties( IWbemClassObject* pCookingClassObject, IWbemObjectAccess *pRawClass );
  63. // Standard COM methods
  64. // ====================
  65. STDMETHODIMP QueryInterface(REFIID riid, void** ppv);
  66. STDMETHODIMP_(ULONG) AddRef();
  67. STDMETHODIMP_(ULONG) Release();
  68. // IWMISimpleObjectCooker COM Interface
  69. // ====================================
  70. STDMETHODIMP SetClass(
  71. /*[in] */ WCHAR* wszCookingClassName,
  72. /*[in] */ IWbemObjectAccess *pCookingClass,
  73. /*[in] */ IWbemObjectAccess *pRawClass);
  74. STDMETHODIMP SetCookedInstance(
  75. /*[in] */ IWbemObjectAccess *pCookedInstance,
  76. /*[out] */ long *plId
  77. );
  78. STDMETHODIMP BeginCooking(
  79. /*[in] */ long lId,
  80. /*[in] */ IWbemObjectAccess *pSampleInstance,
  81. /*[in] */ unsigned long dwRefresherId);
  82. STDMETHODIMP StopCooking(
  83. /*[in] */ long lId);
  84. STDMETHODIMP Recalc(/*[in] */ unsigned long dwRefresherId);
  85. STDMETHODIMP Remove(
  86. /*[in] */ long lId);
  87. STDMETHODIMP Reset();
  88. };
  89. #endif //_WMIOBJCOOKER_H_