// RcCameraTransformExample.h : Declaration of the CRcCameraTransformExample

#pragma once
#include "resource.h"       // main symbols
#include <comsvcs.h>

// IRcCameraTransformExample
MIDL_INTERFACE("58A069AE-81E4-4f19-A913-D41E61AF33E2") IRcCameraTransformExample : IUnknown
{
};

// CRcCameraTransformExample


class ATL_NO_VTABLE CRcCameraTransformExample : 
    public CComObjectRootEx<CComGlobalsThreadModel>,
    public IRsUnknownNode,
    public IRsCommand,
	public IRcCameraTransformExample
{
public:
	CRcCameraTransformExample()
	{
	}

    BEGIN_COM_MAP(CRcCameraTransformExample)
        COM_INTERFACE_ENTRY(IRcCameraTransformExample)
        COM_INTERFACE_ENTRY(IRsUnknownNode)
        COM_INTERFACE_ENTRY(IRsCommand)
        COM_INTERFACE_ENTRY2(IUnknown, IRsUnknownNode)
        COM_INTERFACE_ENTRY2(IRsObject, IRsUnknownNode)
        COM_INTERFACE_ENTRY_AGGREGATE(DEF_GUIDNAME(IRsBaseNode), m_pUnkAgg.p)
        /// Just for safety, the speed is slower only for unknown interfaces
        COM_INTERFACE_ENTRY_AGGREGATE_BLIND(m_pUnkAgg.p)    
    END_COM_MAP()

    DECLARE_GET_CONTROLLING_UNKNOWN()
	DECLARE_PROTECT_FINAL_CONSTRUCT()

	HRESULT FinalConstruct();
	
	void FinalRelease() 
	{
        m_pUnkAgg.Release();
	}

public:

    // IRsCommand
    STDMETHOD(Execute)(void);
    STDMETHOD(Undo)(void);
    STDMETHOD(Redo)(void);
    STDMETHOD(HasUndo)(RtBool* isUndoable);

    // IRsUnknownNode
    STDMETHOD(OnGetValue)(CONID con_id, IRsDataCache* pDataCache, VARIANT* pVtData, RtBool* pHandled);
    STDMETHOD(OnSetValue)(CONID con_id, IRsDataCache* pDataCache, VARIANT* pvtData, RtBool* pHandled);
    STDMETHOD(OnDefaultValue)(CONID con_id, VARIANT* pVtData, RtBool* pHandled);
    STDMETHOD(OnInvalidate)(CONID con_id, RtBool* pHandled);
    STDMETHOD(OnInitialize)(void);
    STDMETHOD(OnLoadDefault)(void);
    STDMETHOD(OnDestroy)(void);

    // IRsObject
    RS_DECLARE_IRS_OBJECT(IRcCameraTransformExample, L"Camera transform example")


private:
    CComPtr<IUnknown> m_pUnkAgg;   
};

