ReactOS  0.4.14-dev-50-g13bb5e2
CUnknownBase< Interface > Class Template Referenceabstract

#include <unknownbase.h>

Inheritance diagram for CUnknownBase< Interface >:
Collaboration diagram for CUnknownBase< Interface >:

Public Member Functions

 CUnknownBase (bool autoDelete=true, LONG initialRef=0)
 
ULONG STDMETHODCALLTYPE AddRef ()
 
ULONG STDMETHODCALLTYPE Release ()
 
HRESULT STDMETHODCALLTYPE QueryInterface (REFIID riid, void **ppv)
 
virtual ~CUnknownBase ()
 
LONG GetRef () const
 

Protected Member Functions

virtual const QITABGetQITab ()=0
 

Private Attributes

LONG m_lRef
 
bool m_AutoDelete
 

Detailed Description

template<typename Interface>
class CUnknownBase< Interface >

Definition at line 5 of file unknownbase.h.

Constructor & Destructor Documentation

◆ CUnknownBase()

template<typename Interface>
CUnknownBase< Interface >::CUnknownBase ( bool  autoDelete = true,
LONG  initialRef = 0 
)
inline

Definition at line 13 of file unknownbase.h.

14  : m_lRef(initialRef),
15  m_AutoDelete(autoDelete)
16  {
17  }
bool m_AutoDelete
Definition: unknownbase.h:8

◆ ~CUnknownBase()

template<typename Interface>
virtual CUnknownBase< Interface >::~CUnknownBase ( )
inlinevirtual

Definition at line 39 of file unknownbase.h.

39 {}

Member Function Documentation

◆ AddRef()

template<typename Interface>
ULONG STDMETHODCALLTYPE CUnknownBase< Interface >::AddRef ( void  )
inline

Definition at line 19 of file unknownbase.h.

20  {
21  return InterlockedIncrement( &m_lRef );
22  }
#define InterlockedIncrement
Definition: armddk.h:53

◆ GetQITab()

template<typename Interface>
virtual const QITAB* CUnknownBase< Interface >::GetQITab ( )
protectedpure virtual

◆ GetRef()

template<typename Interface>
LONG CUnknownBase< Interface >::GetRef ( ) const
inline

Definition at line 41 of file unknownbase.h.

42  {
43  return m_lRef;
44  }

◆ QueryInterface()

template<typename Interface>
HRESULT STDMETHODCALLTYPE CUnknownBase< Interface >::QueryInterface ( REFIID  riid,
void **  ppv 
)
inline

Definition at line 34 of file unknownbase.h.

35  {
36  return QISearch(this, GetQITab(), riid, ppv);
37  }
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
HRESULT WINAPI QISearch(void *base, const QITAB *table, REFIID riid, void **ppv)
Definition: ordinal.c:2343
virtual const QITAB * GetQITab()=0

Referenced by CTestSpy::QueryInterface().

◆ Release()

template<typename Interface>
ULONG STDMETHODCALLTYPE CUnknownBase< Interface >::Release ( void  )
inline

Definition at line 24 of file unknownbase.h.

25  {
26  long newref = InterlockedDecrement( &m_lRef );
27  if (m_AutoDelete && newref<=0)
28  {
29  delete this;
30  }
31  return newref;
32  }
bool m_AutoDelete
Definition: unknownbase.h:8
#define InterlockedDecrement
Definition: armddk.h:52

Member Data Documentation

◆ m_AutoDelete

template<typename Interface>
bool CUnknownBase< Interface >::m_AutoDelete
private

Definition at line 8 of file unknownbase.h.

Referenced by CUnknownBase< IShellMenuCallback >::Release().

◆ m_lRef


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