ReactOS 0.4.15-dev-8119-g4fb2fdb
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 ( )
inline

Definition at line 19 of file unknownbase.h.

20 {
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 }
virtual const QITAB * GetQITab()=0
HRESULT WINAPI QISearch(void *base, const QITAB *table, REFIID riid, void **ppv)
Definition: ordinal.c:2392
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39

Referenced by CTestSpy::QueryInterface().

◆ Release()

template<typename Interface >
ULONG STDMETHODCALLTYPE CUnknownBase< Interface >::Release ( )
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 }
#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< Interface >::Release().

◆ m_lRef


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