ReactOS 0.4.16-dev-197-g92996da
ATL::CComPolyObject< contained > Class Template Reference

#include <atlcom.h>

Inheritance diagram for ATL::CComPolyObject< contained >:
Collaboration diagram for ATL::CComPolyObject< contained >:

Public Member Functions

 CComPolyObject (void *pv=NULL)
 
virtual ~CComPolyObject ()
 
HRESULT FinalConstruct ()
 
void FinalRelease ()
 
 STDMETHOD_ (ULONG, AddRef)()
 
 STDMETHOD_ (ULONG, Release)()
 
STDMETHOD() QueryInterface (REFIID iid, void **ppvObject)
 

Static Public Member Functions

static HRESULT WINAPI CreateInstance (IUnknown *punkOuter, CComPolyObject< contained > **pp)
 

Public Attributes

CComContainedObject< contained > m_contained
 

Detailed Description

template<class contained>
class ATL::CComPolyObject< contained >

Definition at line 321 of file atlcom.h.

Constructor & Destructor Documentation

◆ CComPolyObject()

template<class contained >
ATL::CComPolyObject< contained >::CComPolyObject ( void pv = NULL)
inline

Definition at line 326 of file atlcom.h.

327 : m_contained(pv ? static_cast<contained*>(pv) : this)
328 {
329 _pAtlModule->Lock();
330 }
CComContainedObject< contained > m_contained
Definition: atlcom.h:324

◆ ~CComPolyObject()

template<class contained >
virtual ATL::CComPolyObject< contained >::~CComPolyObject ( )
inlinevirtual

Definition at line 332 of file atlcom.h.

333 {
334 this->FinalRelease();
335 _pAtlModule->Unlock();
336 }
void FinalRelease()
Definition: atlcom.h:342

Member Function Documentation

◆ CreateInstance()

template<class contained >
static HRESULT WINAPI ATL::CComPolyObject< contained >::CreateInstance ( IUnknown punkOuter,
CComPolyObject< contained > **  pp 
)
inlinestatic

Definition at line 372 of file atlcom.h.

373 {
374 CComPolyObject<contained> *newInstance;
375 HRESULT hResult;
376
377 ATLASSERT(pp != NULL);
378 if (pp == NULL)
379 return E_POINTER;
380
381 hResult = E_OUTOFMEMORY;
382 newInstance = NULL;
383 ATLTRY(newInstance = new CComPolyObject<contained>(punkOuter))
384 if (newInstance != NULL)
385 {
386 newInstance->SetVoid(NULL);
387 newInstance->InternalFinalConstructAddRef();
388 hResult = newInstance->_AtlInitialConstruct();
389 if (SUCCEEDED(hResult))
390 hResult = newInstance->FinalConstruct();
391 if (SUCCEEDED(hResult))
392 hResult = newInstance->_AtlFinalConstruct();
393 newInstance->InternalFinalConstructRelease();
394 if (hResult != S_OK)
395 {
396 delete newInstance;
397 newInstance = NULL;
398 }
399 }
400 *pp = newInstance;
401 return hResult;
402 }
#define ATLASSERT(x)
Definition: CComVariant.cpp:10
#define ATLTRY(x)
Definition: atlcomcli.h:44
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define NULL
Definition: types.h:112
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define E_POINTER
Definition: winerror.h:2365

◆ FinalConstruct()

template<class contained >
HRESULT ATL::CComPolyObject< contained >::FinalConstruct ( )
inline

Definition at line 338 of file atlcom.h.

339 {
340 return m_contained.FinalConstruct();
341 }

Referenced by ATL::CComPolyObject< contained >::CreateInstance().

◆ FinalRelease()

template<class contained >
void ATL::CComPolyObject< contained >::FinalRelease ( )
inline

Definition at line 342 of file atlcom.h.

343 {
344 m_contained.FinalRelease();
345 }

Referenced by ATL::CComPolyObject< contained >::~CComPolyObject().

◆ QueryInterface()

template<class contained >
STDMETHOD() ATL::CComPolyObject< contained >::QueryInterface ( REFIID  iid,
void **  ppvObject 
)
inline

Definition at line 361 of file atlcom.h.

362 {
363 if (ppvObject == NULL)
364 return E_POINTER;
365 if (iid == IID_IUnknown)
366 *ppvObject = reinterpret_cast<void*>(this);
367 else
368 return m_contained._InternalQueryInterface(iid, ppvObject);
369 return S_OK;
370 }
const GUID IID_IUnknown
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082

◆ STDMETHOD_() [1/2]

template<class contained >
ATL::CComPolyObject< contained >::STDMETHOD_ ( ULONG  ,
AddRef   
)
inline

Definition at line 347 of file atlcom.h.

348 {
349 return this->InternalAddRef();
350 }

◆ STDMETHOD_() [2/2]

template<class contained >
ATL::CComPolyObject< contained >::STDMETHOD_ ( ULONG  ,
Release   
)
inline

Definition at line 352 of file atlcom.h.

353 {
354 ULONG newRefCount;
355 newRefCount = this->InternalRelease();
356 if (newRefCount == 0)
357 delete this;
358 return newRefCount;
359 }
uint32_t ULONG
Definition: typedefs.h:59

Member Data Documentation

◆ m_contained


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