// RsDoFactory.h : Declaration of the CRsDoFactory

#pragma once


// CRsDoFactory
class ATL_NO_VTABLE CRsDoFactory :
	public CComObjectRootEx<CComGlobalsThreadModel>,
	public IRsDataObjFactory
{
public:
	CRsDoFactory()
	{
	}

	BEGIN_COM_MAP(CRsDoFactory)
        COM_INTERFACE_ENTRY(IRsDataObjFactory)
        COM_INTERFACE_ENTRY2(IUnknown, IRsDataObjFactory)
    END_COM_MAP()

	DECLARE_CLASSFACTORY_SINGLETON(CRsDoFactory)
    DECLARE_NOT_AGGREGATABLE(CRsDoFactory)
    DECLARE_PROTECT_FINAL_CONSTRUCT()

	HRESULT FinalConstruct()
	{
		return S_OK;
	}
	
	void FinalRelease() 
	{
	}

public:
	/** Creates an uninitialized data object.
		@param piid [in] Pointer to the identifier of the data object
		@param ppNode [out] Address of DataObject Interface variable that receives the interface pointer 
			to newly created object.
		@return This method supports the standard return values E_INVALIDARG, E_OUTOFMEMORY, and E_UNEXPECTED, as well as the following: 
		@return S_OK The specified object was created. 
		@return E_NOTIMPL This data object factory does not support instancing data object
	*/
	STDMETHOD(CreateInstance)(const IID* piid, IRsDataObject** ppDataObj);
	
	/** Creates an uninitialized data object that is part of an aggregate.
			@param pUnkOuter [in] pointer to the controlling IUnknown interface of the aggregate 
            @param riid [in] Reference to the identifier of the node.
			@param ppNode [out] Address of data object Interface variable that receives the interface pointer 
				   to newly created object.
		    @return This method supports the standard return values E_INVALIDARG, E_OUTOFMEMORY, and E_UNEXPECTED, as well as the following: 
			@return S_OK The specified object was created. 
			@return E_NOTIMPL This node factory does not support instancing agregated data objects
    */
	STDMETHOD(CreateAggInstance)(IUnknown* pUnkOuter, const IID *riid, IUnknown** ppvObject);

	/** Enumerates data object's descriptors of current factory object
            @ppEnumNodeDesc Pointer to an IRsEnumDataObjDesc interface.
			@return S_OK Method succeeded.
			@return E_NOTIMPL This data object factory does not support enumeration of Data object's descriptors
    */
	STDMETHOD(EnumDataObjDesc)(IRsEnumDataObjDesc** ppEnumDataObjDesc);
};