// RsTemplateRenderData.h : Declaration of the CRsTemplateRenderData

#pragma once
#include "resource.h"       // main symbols

#if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA)
#error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms."
#endif


[
	object,
	uuid("97DA2192-8F20-4a6d-A905-232FC053062E"),
	helpstring("IRsTemplateRenderData Interface"),
	pointer_default(unique)
]
__interface IRsTemplateRenderData : IUnknown
{
	/**
	Set new node name
	@param bszNodeName – node name
	*/
	[helpstring("method SetNodeName")] HRESULT SetNodeName([in] BSTR bszNodeName);

	/**
	Get node name
	@param pbszNodeName – returned node name
	*/
	[helpstring("method GetNodeName")] HRESULT GetNodeName([out, retval] BSTR* pbszNodeName);


	/**
	Add connector descriptor to cached array
	@param pConDesc – connector descriptor
	*/
	[helpstring("method AddConDescriptor")] HRESULT AddConDescriptor([in] IRsConDescriptor* pConDesc);


	/**
	Get cached connector descriptor from array
	@param ulPos – position in array
	@param ppConDesc – returned connector descriptor
	*/
	[helpstring("method GetConDescriptorAt")] HRESULT GetConDescriptorAt([in] RtUlong ulPos, [out, retval] IRsConDescriptor** ppConDesc);

	/**
	Return connector descriptor count
	@param pulCount – number of elements in array
	*/
	[helpstring("method ConDescriptorCount")] HRESULT ConDescriptorCount([out, retval] RtUlong* pulCount);
	


};



// CRsTemplateRenderData
class ATL_NO_VTABLE CRsTemplateRenderData :
	public CComObjectRootEx<CComGlobalsThreadModel>,
	public IRsTemplateRenderData,
	public IRsViewRenderData
{
public:
	CRsTemplateRenderData()
	{
	}

	BEGIN_COM_MAP(CRsTemplateRenderData)
        COM_INTERFACE_ENTRY(IRsTemplateRenderData)
		COM_INTERFACE_ENTRY(IRsViewRenderData)
		COM_INTERFACE_ENTRY2(IUnknown,IRsTemplateRenderData)
    END_COM_MAP()

	DECLARE_PROTECT_FINAL_CONSTRUCT()

	HRESULT FinalConstruct()
	{
		return S_OK;
	}

	void FinalRelease()
	{
	}

	// IRsTEmplateRenderData
	STDMETHOD(SetNodeName)(BSTR bszNodeName);
	STDMETHOD(GetNodeName)(BSTR* pbszNodeName);
	STDMETHOD(AddConDescriptor)(IRsConDescriptor* pConDesc);
	STDMETHOD(GetConDescriptorAt)(RtUlong ulPos, IRsConDescriptor** ppConDesc);
	STDMETHOD(ConDescriptorCount)(RtUlong* pulCount);
	
private:

	// node name
	CComBSTR							m_bszNodeName;
	
	// array of descriptors
	CInterfaceArray<IRsConDescriptor>	m_aConDesc;
};

