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.

145 lines
3.1 KiB

  1. /*++
  2. Copyright (C) 1996-2001 Microsoft Corporation
  3. Module Name:
  4. RawCooker.h
  5. Abstract:
  6. The classes required to perform cooking based on a countertype
  7. History:
  8. a-dcrews 01-Mar-00 Created
  9. --*/
  10. #ifndef _RAWCOOKER_H_
  11. #define _RAWCOOKER_H_
  12. #include <wbemint.h>
  13. #include "CookerUtils.h"
  14. //////////////////////////////////////////////////////////////////
  15. //
  16. // CEquationRecord
  17. //
  18. // Contains all of the required information to describe either
  19. // a predefined or used defined equation
  20. //
  21. //////////////////////////////////////////////////////////////////
  22. typedef __int64* PINT64;
  23. typedef DWORD (APIENTRY PERFCALC)(DWORD, PINT64, PINT64, PINT64, INT64, PINT64);
  24. class CCalcRecord
  25. {
  26. DWORD m_dwID;
  27. PERFCALC *m_pCalc;
  28. public:
  29. void Init( DWORD dwID, PERFCALC *pCalc )
  30. {
  31. m_dwID = dwID;
  32. m_pCalc = pCalc;
  33. }
  34. DWORD GetID(){ return m_dwID; }
  35. PERFCALC* GetCalc(){ return m_pCalc; }
  36. };
  37. class CCalcTable
  38. {
  39. long m_lSize; // Size of table
  40. CCalcRecord m_aTable[7]; // Lookup table
  41. public:
  42. CCalcTable();
  43. virtual ~CCalcTable();
  44. CCalcRecord* GetCalcRecord( DWORD dwCookingType );
  45. };
  46. //////////////////////////////////////////////////////////////////
  47. //
  48. // CRawCooker
  49. //
  50. // Represents the cooking mechanism.
  51. //
  52. //////////////////////////////////////////////////////////////////
  53. class CRawCooker : public IWMISimpleCooker
  54. {
  55. long m_lRef; // Reference counter
  56. CCalcTable m_CalcTable; // Equation lookup table
  57. CCalcRecord* m_pCalcRecord; // A cache of the last record
  58. public:
  59. CRawCooker();
  60. virtual ~CRawCooker();
  61. // Standard COM methods
  62. // ====================
  63. STDMETHODIMP QueryInterface(REFIID riid, void** ppv);
  64. STDMETHODIMP_(ULONG) AddRef();
  65. STDMETHODIMP_(ULONG) Release();
  66. // IWMISimpleCooker COM Interface
  67. // ==============================
  68. STDMETHODIMP CookRawValues(
  69. /*[in] */ DWORD dwCookingType,
  70. /*[in] */ DWORD dwNumSamples,
  71. /*[in] */ __int64* anTimeStamp,
  72. /*[in] */ __int64* anRawValue,
  73. /*[in] */ __int64* anBase,
  74. /*[in] */ __int64 nTimeFrequency,
  75. /*[in] */ long Scale,
  76. /*[out] */ __int64* pnResult );
  77. PERFCALC* GetCalc( DWORD dwCookingType );
  78. static WMISTATUS APIENTRY _Average( DWORD dwNumSamples,
  79. __int64* anTimeStamp,
  80. __int64* anRawValue,
  81. __int64* anBase,
  82. __int64 nTimeFrequency,
  83. __int64* pnResult);
  84. static WMISTATUS APIENTRY _Min( DWORD dwNumSamples,
  85. __int64* anTimeStamp,
  86. __int64* anRawValue,
  87. __int64* anBase,
  88. __int64 nTimeFrequency,
  89. __int64* pnResult);
  90. static WMISTATUS APIENTRY _Max( DWORD dwNumSamples,
  91. __int64* anTimeStamp,
  92. __int64* anRawValue,
  93. __int64* anBase,
  94. __int64 nTimeFrequency,
  95. __int64* pnResult);
  96. static WMISTATUS APIENTRY _Range( DWORD dwNumSamples,
  97. __int64* anTimeStamp,
  98. __int64* anRawValue,
  99. __int64* anBase,
  100. __int64 nTimeFrequency,
  101. __int64* pnResult);
  102. static WMISTATUS APIENTRY _Variance( DWORD dwNumSamples,
  103. __int64* anTimeStamp,
  104. __int64* anRawValue,
  105. __int64* anBase,
  106. __int64 nTimeFrequency,
  107. __int64* pnResult);
  108. };
  109. #endif //_RAWCOOKER_H_