#pragma once

#include <comdef.h>
#include <Wbemidl.h>

namespace Win {

class WmiObject;

class EventSink : public IWbemObjectSink
{
    LONG m_lRef;
    bool bDone;
    WmiObject *m_wmiObj;

public:
    EventSink(WmiObject *obj)
    {
        m_lRef = 0;
        m_wmiObj = obj;
    }

    ~EventSink() { bDone = true; }

    virtual ULONG STDMETHODCALLTYPE AddRef();
    virtual ULONG STDMETHODCALLTYPE Release();
    virtual HRESULT
    STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppv);

    virtual HRESULT STDMETHODCALLTYPE Indicate(
        LONG lObjectCount,
        IWbemClassObject __RPC_FAR *__RPC_FAR *apObjArray
    );

    virtual HRESULT STDMETHODCALLTYPE SetStatus(
        /* [in] */ LONG lFlags,
        /* [in] */ HRESULT hResult,
        /* [in] */ BSTR strParam,
        /* [in] */ IWbemClassObject __RPC_FAR *pObjParam
    );
};

}
