INOS
CINOSRefCount Class Reference

#include <inos_syn.h>

Public Member Functions

 CINOSRefCount (const char *apParentName, const char *apBaseName, int32 aiInitialCount=0, void *apHandlerObj=NULL, void *apHandlerFunc=NULL)
 Create a reference counter with the given name.
 
virtual ~CINOSRefCount ()
 Destroy reference counter.
 
int32 Increment ()
 Increment the reference counter and return the new value.
 
int32 Decrement ()
 Decrement the reference counter and return the new value.
 
int32 GetCount ()
 Get current count.
 
void SetCount (int32 aiNewCount)
 Set current count.
 

Protected Member Functions

uint32 Request ()
 
void Release ()
 
 DECLARE_DYNAMIC (CINOSRefCount)
 

Protected Attributes

inosName32 m_sName
 Reference counter name (for debugging purposes)
 
int32 m_iCount
 Reference count.
 
voidm_pHandlerObj
 Handler method to call when count reaches 0.
 
voidm_pHandlerFunc
 

Friends

class CINOSLockGuard< CINOSRefCount >
 interface required for CINOSLockGuard
 

Detailed Description

This class implements a thread-safe reference counter that can be used to call some member function every time the counter is decremented to 0.

Constructor & Destructor Documentation

◆ CINOSRefCount()

CINOSRefCount::CINOSRefCount ( const char apParentName,
const char apBaseName,
int32  aiInitialCount = 0,
void apHandlerObj = NULL,
void apHandlerFunc = NULL 
)

Create a reference counter with the given name.

Parameters
apParentNameName of parent object
apBaseNameName of reference counter object
auInitialCountRequested initial count

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