Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
Gray::cRefBase Class Reference

#include <cRefPtr.h>

Inheritance diagram for Gray::cRefBase:
IUnknown Gray::cListNodeRef< cUnitTestListRef > Gray::cSingletonSmart< cSQLMgr > Gray::cSingletonSmart< cNetSystem > Gray::cSingletonSmart< cXObjMgr > Gray::cSingletonSmart< cLogAppendConsole > Gray::cSingletonSmart< cJSXEngine > Gray3D::cModel3DSMaterialInfo Gray3D::cModel3DSObject Gray3D::cModelFrame Gray3D::cModelMeshCont Gray3D::cXResourceFile Gray::CStringData Gray::cAtomDef Gray::cIUnkAgg Gray::cIniSectionEntry Gray::cListNodeRef< _TYPE_REC > Gray::cLogAppendCache Gray::cLogAppendDebug Gray::cLogAppendTextArray Gray::cLogEvent Gray::cMemPage Gray::cSingletonSmart< TYPE > Gray::cThreadLockableRW Gray::cThreadLockableRef GrayFTP::cClientFTPBase GrayFTP::cFTPAccount GrayFTP::cFTPDataParams GrayFTP::cFTPGUI GrayGUI::cXDialogPlacementObj GrayGUI::cXStaticTextHyperlink GrayJS::cJSXClass GrayJS::cJSXContext GrayJS::cJSXObject GrayLib::cAVFrame GrayLib::cControllerBase GrayLib::cFileChangeElem GrayLib::cFontBase GrayLib::cHttpController GrayLib::cHttpProtocolStream GrayLib::cImageBase GrayLib::cJobBase GrayLib::cKeyBase GrayLib::cLogAppendFile GrayLib::cLogFileTail GrayLib::cLogQuestion GrayLib::cManifestElem GrayLib::cNetHostRangeX4 GrayLib::cNetServerConnection GrayLib::cNetServerPort GrayLib::cODBCBase GrayLib::cRIFFBlock GrayLib::cResDlgInitItem GrayLib::cResDlgTemplateItem GrayLib::cSQLDatabase GrayLib::cSQLDriver GrayLib::cSSLServerStream GrayLib::cScriptTagDef GrayLib::cScriptableInterfaceDynamic GrayLib::cScriptablePropDynamic GrayLib::cSecureServerStream GrayLib::cSoundFileObj GrayLib::cStrPathNode GrayLib::cSyncOp GrayLib::cThread GrayLib::cTimeScheduleVal GrayLib::cTimerInst GrayLib::cUnitTestTelnetStream GrayLib::cVarTuple GrayLib::cVariantMap GrayLib::cVoIPChannel GrayLib::cVoIPConnect GrayLib::cVoIPUser GrayLib::cX509Common GrayLib::cXProtocolServerStreamImpl GrayMapData::CMapMover GrayMapData::CMultiDefElement GraySQLite::cSQLiteBase

Public Member Functions

 cRefBase (int iRefCount=0) noexcept
 
virtual ~cRefBase ()
 
int get_RefCount () const noexcept
 
HASHCODE_t get_HashCode () const noexcept
 
 STDMETHOD_ (HASHCODE_t, get_HashCodeX)() const noexcept
 
virtual void onFinalRelease ()
 
bool isValidObj () const noexcept
 
 STDMETHOD_ (ULONG, AddRef)(void) override
 
 STDMETHOD_ (ULONG, Release)(void) override
 
STDMETHOD() QueryInterface (const IID &riid, void __RPC_FAR *__RPC_FAR *ppvObject) override
 
void IncRefCount ()
 
void DecRefCount ()
 
bool isStaticConstruct () const noexcept
 
void StaticConstruct ()
 
void StaticDestruct ()
 
bool isDestructing () noexcept
 
void SetDestructing ()
 

Detailed Description

base class for some derived object that is to be reference counted via cRefPtr. similar to std::shared_ptr<TYPE> ?

Note
These objects are normally cHeapObject, but NOT ALWAYS ! (allow static versions using StaticConstruct() and k_REFCOUNT_STATIC)
These objects emulate the COM IUnknown. we may use cIUnkPtr<> for this also. Use IUNKNOWN_DISAMBIG(cRefBase) with this

Constructor & Destructor Documentation

◆ cRefBase()

Gray::cRefBase::cRefBase ( int  iRefCount = 0)
inlineexplicitnoexcept

◆ ~cRefBase()

virtual Gray::cRefBase::~cRefBase ( )
inlinevirtual

ASSUME StaticDestruct() was called if needed.

Member Function Documentation

◆ DecRefCount()

void Gray::cRefBase::DecRefCount ( )
inline

◆ get_HashCode()

HASHCODE_t Gray::cRefBase::get_HashCode ( ) const
inlinenoexcept

get a unique (only on this machine/process instance) hash code.

◆ get_RefCount()

int Gray::cRefBase::get_RefCount ( ) const
inlinenoexcept

◆ IncRefCount()

void Gray::cRefBase::IncRefCount ( )
inline

◆ isDestructing()

bool Gray::cRefBase::isDestructing ( )
inlinenoexcept

◆ isStaticConstruct()

bool Gray::cRefBase::isStaticConstruct ( ) const
inlinenoexcept

Was StaticConstruct() called for this ?

◆ isValidObj()

bool Gray::cRefBase::isValidObj ( ) const
inlinenoexcept

◆ onFinalRelease()

virtual void Gray::cRefBase::onFinalRelease ( )
inlinevirtual

Zero references to this exist so we can destroy it.

Note
Obviously this should NEVER be called for a static or stack based object. use StaticConstruct() for these. MFC CCmdTarget has similar OnFinalRelease()

◆ QueryInterface()

STDMETHOD() Gray::cRefBase::QueryInterface ( const IID riid,
void __RPC_FAR *__RPC_FAR *  ppvObject 
)
inlineoverride

like COM IUnknown::QueryInterface

◆ SetDestructing()

void Gray::cRefBase::SetDestructing ( )
inline

object is in the act of destruction.

◆ StaticConstruct()

void Gray::cRefBase::StaticConstruct ( )
inline

If this is static, not dynamic. Call this in parents constructor or main (if global).

◆ StaticDestruct()

void Gray::cRefBase::StaticDestruct ( )
inline

static objects can fix themselves this way. ASSUME StaticConstruct() called for this.

◆ STDMETHOD_() [1/3]

Gray::cRefBase::STDMETHOD_ ( HASHCODE_t  ,
get_HashCodeX   
) const
inlinenoexcept

virtualized version of get_HashCode.

◆ STDMETHOD_() [2/3]

Gray::cRefBase::STDMETHOD_ ( ULONG  ,
AddRef   
)
inlineoverride

like COM IUnknown::AddRef

◆ STDMETHOD_() [3/3]

Gray::cRefBase::STDMETHOD_ ( ULONG  ,
Release   
)
inlineoverride

like COM IUnknown::Release


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