ReactOS  0.4.15-dev-3193-g74513a7
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 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 715 of file atlcom.h.

Constructor & Destructor Documentation

◆ CComClassFactorySingleton()

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

Definition at line 723 of file atlcom.h.

723  :
724  m_hrCreate(S_OK),
725  m_spObj(NULL)
726  {
727  }
#define S_OK
Definition: intsafe.h:52
#define NULL
Definition: types.h:112

Member Function Documentation

◆ CreateInstance()

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

Definition at line 729 of file atlcom.h.

730  {
731  HRESULT hResult;
732 
733  if (ppvObj == NULL)
734  return E_POINTER;
735  *ppvObj = NULL;
736 
737  if (pUnkOuter != NULL)
738  hResult = CLASS_E_NOAGGREGATION;
739  else if (m_hrCreate == S_OK && m_spObj == NULL)
740  {
741  _SEH2_TRY
742  {
743  Lock();
744  if (m_hrCreate == S_OK && m_spObj == NULL)
745  {
746  CComObjectCached<T> *pObj;
748  if (SUCCEEDED(m_hrCreate))
749  {
750  m_hrCreate = pObj->QueryInterface(IID_IUnknown, reinterpret_cast<PVOID *>(&m_spObj));
751  if (FAILED(m_hrCreate))
752  delete pObj;
753  }
754  }
755  }
757  {
758  Unlock();
759  }
760  _SEH2_END;
761  }
762  if (m_hrCreate == S_OK)
763  hResult = m_spObj->QueryInterface(riid, ppvObj);
764  else
765  hResult = m_hrCreate;
766  return hResult;
767  }
static HRESULT WINAPI CreateInstance(CComObjectCached< Base > **pp)
Definition: atlcom.h:509
REFIID riid
Definition: precomp.h:44
_SEH2_TRY
Definition: create.c:4226
if SUCCEEDED(hr)
LONG HRESULT
Definition: typedefs.h:79
const GUID IID_IUnknown
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662
#define S_OK
Definition: intsafe.h:52
_SEH2_END
Definition: create.c:4400
_SEH2_FINALLY
Definition: create.c:4371
#define NULL
Definition: types.h:112
HRESULT QueryInterface([in] REFIID riid, [out, iid_is(riid)] void **ppvObject)
#define E_POINTER
Definition: winerror.h:2365

Member Data Documentation

◆ m_hrCreate

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

Definition at line 719 of file atlcom.h.

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

◆ m_spObj

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

Definition at line 720 of file atlcom.h.

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


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