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

Constructor & Destructor Documentation

◆ CComPolyObject()

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

Definition at line 321 of file atlcom.h.

322  : m_contained(pv ? static_cast<contained*>(pv) : this)
323  {
324  _pAtlModule->Lock();
325  }
CComContainedObject< contained > m_contained
Definition: atlcom.h:319

◆ ~CComPolyObject()

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

Definition at line 327 of file atlcom.h.

328  {
329  this->FinalRelease();
330  _pAtlModule->Unlock();
331  }
void FinalRelease()
Definition: atlcom.h:337

Member Function Documentation

◆ CreateInstance()

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

Definition at line 367 of file atlcom.h.

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

◆ FinalConstruct()

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

Definition at line 333 of file atlcom.h.

334  {
335  return m_contained.FinalConstruct();
336  }
CComContainedObject< contained > m_contained
Definition: atlcom.h:319

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

◆ FinalRelease()

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

Definition at line 337 of file atlcom.h.

338  {
339  m_contained.FinalRelease();
340  }
CComContainedObject< contained > m_contained
Definition: atlcom.h:319

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

◆ QueryInterface()

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

Definition at line 356 of file atlcom.h.

357  {
358  if (ppvObject == NULL)
359  return E_POINTER;
360  if (iid == IID_IUnknown)
361  *ppvObject = reinterpret_cast<void*>(this);
362  else
363  return m_contained._InternalQueryInterface(iid, ppvObject);
364  return S_OK;
365  }
CComContainedObject< contained > m_contained
Definition: atlcom.h:319
const GUID IID_IUnknown
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define S_OK
Definition: intsafe.h:52
#define NULL
Definition: types.h:112
#define E_POINTER
Definition: winerror.h:2365

◆ STDMETHOD_() [1/2]

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

Definition at line 342 of file atlcom.h.

343  {
344  return this->InternalAddRef();
345  }

◆ STDMETHOD_() [2/2]

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

Definition at line 347 of file atlcom.h.

348  {
349  ULONG newRefCount;
350  newRefCount = this->InternalRelease();
351  if (newRefCount == 0)
352  delete this;
353  return newRefCount;
354  }
unsigned int ULONG
Definition: retypes.h:1

Member Data Documentation

◆ m_contained


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