import "unknwn.idl";
import "wbemcli.idl";

// Following interface allows for management of refreshable objects and enums that
// can be cooked.

[restricted,local,object,uuid(13ED7E55-8D63-41b0-9086-D0C5C17364C8)]
interface IWMIRefreshableCooker : IUnknown
{
	// Adds a new instance to the refreshable cooker.  The Refreshable Instance
	// will be updated on calls to recalc.
	HRESULT AddInstance(
			[in] IWbemServices* pService,						// The object's namespace
			[in] IWbemObjectAccess* pCookingClass,				// Cooking class
			[in] IWbemObjectAccess* pCookingInstance,			// An instance of the cooking class
			[out] IWbemObjectAccess** ppRefreshableInstance,	// A clone of the instance used for refreshing
			[out] long* plId									// The id of the refreshable cooking instance
		);

	// Adds a new enumeration to the refreshable cooker.  The Refreshable Enumerator
	// will be updated on calls to recalc.
	HRESULT AddEnum(
			[in] IWbemServices* pService,						// The object's namespace
			[in,string] LPCWSTR szCookingClass,					// The cooking class' name
			[in] IWbemHiPerfEnum* pRefreshableEnum,				// The enumerator passed in from WMI
			[out] long* plId									// THe id of the refreshable cooking enumerator
		);

	// Removes the instance or enumerator specified by ulId from the
	// Refreshable Cooker.
	HRESULT Remove(
			[in] long lId
		);

	// Refreshes all instances and enumerators in the refreshable cooker	
	HRESULT Refresh();

};


// Following interface allows for refreshable objects of the same class to be
// cooked as a group.

[restricted,local,object,uuid(A239BDF1-0AB1-45a0-8764-159115689589)]
interface IWMISimpleObjectCooker : IUnknown
{
	// Sets the class used by the cooker in order to fill out
	// instances when cooking.  Once the class is set, it cannot
	// be reset
	HRESULT SetClass(
			[in] WCHAR* wszCookingClassName,
			[in] IWbemObjectAccess* pCookingClass,
			[in] IWbemObjectAccess* pRawClass
		);

	// Retrieves a new cooked instance and an id which can be used
	// to identify it.  The instance will not be updated unless
	// a sample instance is bound to it via BeginCooking()
	HRESULT SetCookedInstance(
			[in] IWbemObjectAccess* pCookedInstance,
			[out] long* plId
		);

	// Provides an initial sample for cooking the instance specified
	// by ulId.  Once the initial sample is set, it can be
	// cleared by calling BeginCooking again with another
	// instance
	HRESULT BeginCooking(
			[in] long lId,
			[in] IWbemObjectAccess* pSampleInstance,
			[in] unsigned long dwRefresherId
		);

	// Tells the cooker to stop cooking the instance specified
	// by ulId.  Cooking can be restarted by calling BeginCooking
	// again.
	HRESULT StopCooking(
			[in] long lId
		);

	// Recalcs all instances using the appropriate cooking instances.
	HRESULT Recalc([in] unsigned long dwRefresherId);

	// Removes an instance from the object cooker
	HRESULT Remove(
			[in] long lId
		);

	// Clears all instances from the cooker.
	HRESULT Reset( void );

};

// Following interface allows for simple cooking of properties whose formulas
// can be defined using 1 or 2 value samples.

[restricted,local,object,uuid(510ADF6E-D481-4a64-B74A-CC712E11AA34)]
interface IWMISimpleCooker : IUnknown
{
	// Simple method for cooking a two value, one base counter
	HRESULT CookRawValues( 	
		[in]	DWORD	dwCookingType,
		[in]	DWORD	dwNumSamples,
		[in, size_is(dwNumSamples)]	__int64*	anTimeStamp,
		[in, size_is(dwNumSamples)]	__int64*	anRawValue,
		[in, size_is(dwNumSamples)]	__int64*	anBase,
		[in]	__int64		nTimeFrequency,
		[out]	__int64*	pnResult
		);

};

/*
// This interface is a placeholder.  We need to decide if the
// methods below are really appropriate for what we are planning
// to do.

[restricted,local,object,uuid(B1ADC67F-09E6-4adc-A45E-05BA3007CE30)]
interface IWMIComplexCooker : public IUnknown
{

	// Sets a formula in the cooker.  If the formula is known, a known
	// id is returned.  If not, then the formula is parsed and a new
	// id generated
	HRESULT SetFormula( 	
			[in] LPCWSTR pwszCookingType,
			[out] DWORD* pdwId
			);

	// General method for cooking a complex value - assumes that the formula follows
	// timestamp, time frequency, raw value and base value conventions
	HRESULT CookRawValues( 	
			[in] DWORD dwId,
			[in] ULONG nNumTimeStamps,
			[in,size_is(nNumTimeStamps)] unsigned __int64*	pnTimestamps,
			[in] unsigned __int64	nTimeFrequency,
			[in,size_is(nNumTimeFrequency)] unsigned __int64*	pnTimeFrequency,
			[in] ULONG nNumRawValues,
			[in,size_is(nNumRawValues)] unsigned __int64*	pnRawValues,
			[in] ULONG nBaseValues,
			[in,size_is(nBaseValues)] unsigned __int64*	pnBaseValues,
			[out] unsigned __int64  pnResult
			);

	// General method for cooking a free form value by using an array of
	// supplied values.  The cooker uses the values from the array, in order,
	// and applies them  to the formula.
	HRESULT CookGeneralRawValues( 	
			[in] DWORD dwId,
			[in] ULONG nNumValues,
			[in,size_is(nNumTimeStamps)] unsigned __int64*	pnRawValues
			[out] unsigned __int64  pnResult
			);
			
};

// Use arrays of these structures to describe each sample
typedef struct _WMI_COOKING_SAMPLE
{
	ULONG	ulIndex;	// Index in class array
	ULONG	ulCount;	// Num Instances in array
	[size_is(ulCount)] IWbemObjectAccess** apInstances;
} WMI_COOKING_SAMPLE;

// This interface is a placeholder.  We need to decide if the
// methods below are really appropriate for what we are planning
// to do.
[restricted,local,object,uuid(979FF10D-D616-4448-BF08-3A79E01506B0)]
interface IWMIComplexObjectCooker : public IUnknown
{
	// Sets the class used by the cooker in order to fill out
	// instances when cooking.

	HRESULT SetClass(
			[in] IWbemObjectAccess* pCookingClass,
		);

	// Sets the initial instances.  From this point forwards, additional
	// instances are supplied at Recalc time.
	HRESULT SetFirstSample(
			[in] ULONG ulCount,
			[in,size_is(ulCount)] WMI_COOKING_SAMPLE* apSampleData
		);

	// Clears the cooking data and all samples - Initial sample is now required
	HRESULT Reset( void );

	// Recalcs the specified instance using the supplied raw data.  If this
	// is an initial sample, this sets the sample but doesn't atually recalc
	// anything.  Fills out any properties that require cooking.  Any others
	// must be filled out by the user themselves.  This assumes a single instance
	// is used for cooking.
	HRESULT Recalc(
			[in,out] IWbemObjectAccess* pInstance,
			[in] ULONG ulCount,
			[in,size_is(ulCount)] WMI_COOKING_SAMPLE* apSampleData
		);

};

*/