ReactOS 0.4.15-dev-7674-gc0b4db1
ATL::CComClassFactorySingleton< T > Class Template Reference

#include <atlcom.h>

Inheritance diagram for ATL::CComClassFactorySingleton< T >:
Collaboration diagram for ATL::CComClassFactorySingleton< T >:

Public Member Functions

 CComClassFactorySingleton ()
 
STDMETHOD() CreateInstance (LPUNKNOWN pUnkOuter, REFIID riid, void **ppvObj)
 
- Public Member Functions inherited from ATL::CComClassFactory
virtual ~CComClassFactory ()
 
STDMETHOD() CreateInstance (LPUNKNOWN pUnkOuter, REFIID riid, void **ppvObj)
 
STDMETHOD() LockServer (BOOL fLock)
 
void SetVoid (void *pv)
 
- Public Member Functions inherited from IClassFactory
HRESULT CreateInstance ([in, unique] IUnknown *pUnkOuter, [in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
HRESULT RemoteCreateInstance ([in] REFIID riid, [out, iid_is(riid)] IUnknown **ppvObject)
 
HRESULT LockServer ([in] BOOL fLock)
 
HRESULT RemoteLockServer ([in] BOOL fLock)
 
- Public Member Functions inherited from IUnknown
HRESULT QueryInterface ([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
 
ULONG AddRef ()
 
ULONG Release ()
 
- Public Member Functions inherited from ATL::CComObjectRootEx< CComGlobalsThreadModel >
 ~CComObjectRootEx ()
 
ULONG InternalAddRef ()
 
ULONG InternalRelease ()
 
void Lock ()
 
void Unlock ()
 
HRESULT _AtlInitialConstruct ()
 
- Public Member Functions inherited from ATL::CComObjectRootBase
 CComObjectRootBase ()
 
 ~CComObjectRootBase ()
 
void SetVoid (void *)
 
HRESULT _AtlFinalConstruct ()
 
HRESULT FinalConstruct ()
 
void InternalFinalConstructAddRef ()
 
void InternalFinalConstructRelease ()
 
void FinalRelease ()
 

Public Attributes

HRESULT m_hrCreate
 
IUnknownm_spObj
 
- Public Attributes inherited from ATL::CComClassFactory
_ATL_CREATORFUNC * m_pfnCreateInstance
 
- Public Attributes inherited from ATL::CComObjectRootBase
LONG m_dwRef
 

Additional Inherited Members

- Public Types inherited from IClassFactory
typedef IClassFactoryLPCLASSFACTORY
 
- Public Types inherited from IUnknown
typedef IUnknownLPUNKNOWN
 
- Static Public Member Functions inherited from ATL::CComObjectRootBase
static void WINAPI ObjectMain (bool)
 
static const struct _ATL_CATMAP_ENTRYGetCategoryMap ()
 
static HRESULT WINAPI InternalQueryInterface (void *pThis, const _ATL_INTMAP_ENTRY *pEntries, REFIID iid, void **ppvObject)
 

Detailed Description

template<class T>
class ATL::CComClassFactorySingleton< T >

Definition at line 772 of file atlcom.h.

Constructor & Destructor Documentation

◆ CComClassFactorySingleton()

template<class T >
ATL::CComClassFactorySingleton< T >::CComClassFactorySingleton ( )
inline

Definition at line 780 of file atlcom.h.

780 :
783 {
784 }
#define NULL
Definition: types.h:112
#define S_OK
Definition: intsafe.h:52

Member Function Documentation

◆ CreateInstance()

template<class T >
STDMETHOD() ATL::CComClassFactorySingleton< T >::CreateInstance ( LPUNKNOWN  pUnkOuter,
REFIID  riid,
void **  ppvObj 
)
inline

Definition at line 786 of file atlcom.h.

787 {
788 HRESULT hResult;
789
790 if (ppvObj == NULL)
791 return E_POINTER;
792 *ppvObj = NULL;
793
794 if (pUnkOuter != NULL)
795 hResult = CLASS_E_NOAGGREGATION;
796 else if (m_hrCreate == S_OK && m_spObj == NULL)
797 {
799 {
800 Lock();
801 if (m_hrCreate == S_OK && m_spObj == NULL)
802 {
803 CComObjectCached<T> *pObj;
806 {
807 m_hrCreate = pObj->QueryInterface(IID_IUnknown, reinterpret_cast<PVOID *>(&m_spObj));
808 if (FAILED(m_hrCreate))
809 delete pObj;
810 }
811 }
812 }
814 {
815 Unlock();
816 }
817 _SEH2_END;
818 }
819 if (m_hrCreate == S_OK)
820 hResult = m_spObj->QueryInterface(riid, ppvObj);
821 else
822 hResult = m_hrCreate;
823 return hResult;
824 }
const GUID IID_IUnknown
static HRESULT WINAPI CreateInstance(CComObjectCached< Base > **pp)
Definition: atlcom.h:514
#define _SEH2_FINALLY
Definition: filesup.c:21
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
REFIID riid
Definition: atlbase.h:39
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662
#define E_POINTER
Definition: winerror.h:2365

Member Data Documentation

◆ m_hrCreate

template<class T >
HRESULT ATL::CComClassFactorySingleton< T >::m_hrCreate

Definition at line 776 of file atlcom.h.

Referenced by ATL::CComClassFactorySingleton< T >::CreateInstance().

◆ m_spObj

template<class T >
IUnknown* ATL::CComClassFactorySingleton< T >::m_spObj

Definition at line 777 of file atlcom.h.

Referenced by ATL::CComClassFactorySingleton< T >::CreateInstance().


The documentation for this class was generated from the following file: