Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

LibGPIB::ReferenceCount Class Reference

This class is used to implement reference counting in CountedPointer class. More...

#include <ReferenceCount.h>

List of all members.

Public Methods

Constructors and Destructor
 ReferenceCount ()
 Create a ReferenceCount with a count of 1.

 ReferenceCount (const ReferenceCount& other)
 Copy constructor. More...

 ~ReferenceCount ()
 Calls Decrement().

Public Methods
bool IsUnique () const
 This method return true if the reference count has a value of 1.

Operators
ReferenceCount& operator= (const ReferenceCount& other)
 Increment other's count, decrease the current reference count by calling Decrement(), and assign other's mCount to this object.


Private Methods

Privated Methods
void Decrement ()
 Decrease the count by one and delete mCount if its value goes to zero.


Private Attributes

Private Data Members
unsigned int* mCount
 The pointer to the actual count.


Detailed Description

This class is used to implement reference counting in CountedPointer class.

The count itself is implemented as a pointer in this class. This allows ReferenceCount objects be copied using the compiler generator copy constructors for classes which use ReferenceCount objects.

Author(s):
#$Author: pagey $# \URL[Manish P. Pagey]{mailto:pagey@drcsdca.com}

Version:
#$Id: ReferenceCount.h,v 1.1 2000/07/06 05:09:22 pagey Exp $#

Definition at line 24 of file ReferenceCount.h.


Constructor & Destructor Documentation

LibGPIB::ReferenceCount::ReferenceCount ( ) [inline]

Create a ReferenceCount with a count of 1.

Definition at line 128 of file ReferenceCount.h.

LibGPIB::ReferenceCount::ReferenceCount ( const ReferenceCount & other ) [inline]

Copy constructor.

Create a copy of the specified ReferenceCount object and increase the reference count by one.

Definition at line 131 of file ReferenceCount.h.

LibGPIB::ReferenceCount::~ReferenceCount ( ) [inline]

Calls Decrement().

Definition at line 137 of file ReferenceCount.h.


Member Function Documentation

void LibGPIB::ReferenceCount::Decrement ( ) [inline, private]

Decrease the count by one and delete mCount if its value goes to zero.

Definition at line 165 of file ReferenceCount.h.

bool LibGPIB::ReferenceCount::IsUnique ( ) const [inline]

This method return true if the reference count has a value of 1.

Definition at line 143 of file ReferenceCount.h.

ReferenceCount & LibGPIB::ReferenceCount::operator= ( const ReferenceCount & other ) [inline]

Increment other's count, decrease the current reference count by calling Decrement(), and assign other's mCount to this object.

Definition at line 149 of file ReferenceCount.h.


Member Data Documentation

unsigned int * LibGPIB::ReferenceCount::mCount [private]

The pointer to the actual count.

Definition at line 112 of file ReferenceCount.h.


The documentation for this class was generated from the following file:
Generated at Tue Aug 8 01:37:56 2000 for libgpib by doxygen1.1.4 written by Dimitri van Heesch, © 1997-2000