|
Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members
EkCompRefCount Class Template ReferenceThis provides the smart point reference counting functionality.
More...
#include <EkCompRefCount.h>
Collaboration diagram for EkCompRefCount: [legend]List of all members.
Detailed Description
template<class mutex_type>
class EkCompRefCount< mutex_type >
This provides the smart point reference counting functionality.
The smart pointer implementation (EkSmartPtr) is built on the notion of reference counting objects. This means that when someone new starts to point at an object they increment a use count variable in the object they are pointing at. When they cease to point at that object they decrement the use count variable. If the use count variable ever goes to zero the object should be deleted as it is no-longer being referenced by anyone.
Therefore, any class instance that is to be accessed through a smart pointer must support reference counting. The easiest way to obtain reference counting support is to have the class inherit from the EkRefCount class. In the present implementation, each instance of EkRefCount has its own mutex guard.
Usage:
Constructor & Destructor Documentation
template<class mutex_type> |
EkCompRefCount< mutex_type >::EkCompRefCount |
( |
void |
|
) |
[inline] |
|
|
Constructor simply sets useCount to zero.
|
template<class mutex_type> |
EkCompRefCount< mutex_type >::~EkCompRefCount |
( |
void |
|
) |
[inline] |
|
|
Destructor. Does not throw an error if mUseCount != 0. See also, VEkRefCount.
|
template<class mutex_type> |
EkCompRefCount< mutex_type >::EkCompRefCount |
( |
const EkCompRefCount< mutex_type > & |
obj |
) |
[inline] |
|
|
Copy constructor, does NOT copy useCount.
|
Member Function Documentation
template<class mutex_type> |
bool EkCompRefCount< mutex_type >::addRef |
( |
void |
|
) |
[inline] |
|
|
Increment useCount by one.
|
template<class mutex_type> |
bool EkCompRefCount< mutex_type >::deleteRef |
( |
void |
|
) |
[inline] |
|
|
Decrements useCount by one, returns true if the object should be deleted.
|
template<class mutex_type> |
EkCompRefCount< mutex_type > & EkCompRefCount< mutex_type >::operator= |
( |
const EkCompRefCount< mutex_type > & |
obj |
) |
[inline] |
|
|
Assignment operator, does NOT copy useCount.
|
template<class mutex_type> |
long EkCompRefCount< mutex_type >::useCount |
( |
|
) |
const [inline] |
|
|
This returns the useCount.
|
The documentation for this class was generated from the following file:
|