ReactOS  0.4.12-dev-102-g4b7f1e0
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 714 of file atlcom.h.

Constructor & Destructor Documentation

◆ CComClassFactorySingleton()

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

Definition at line 722 of file atlcom.h.

722  :
723  m_hrCreate(S_OK),
724  m_spObj(NULL)
725  {
726  }
smooth NULL
Definition: ftsmooth.c:416
#define S_OK
Definition: intsafe.h:59

Member Function Documentation

◆ CreateInstance()

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

Definition at line 728 of file atlcom.h.

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

Member Data Documentation

◆ m_hrCreate

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

Definition at line 718 of file atlcom.h.

◆ m_spObj

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

Definition at line 719 of file atlcom.h.


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