ReferenceCounter Class Reference

<class description="" goes="" here=""> <short description=""> More...

#include <ReferenceCounter.hpp>

List of all members.


Public Member Functions

void reset ()
 Set counter to 0 and activate it.
bool increase ()
 returns false only when the reference counter was deactivated.
bool decrease ()
 returns false only when release is more often called than use
void deactivate ()
 deactivates the RefCounter.
bool deactivateWhenUsage (unsigned int i)
 deactivates the RefCounter.
bool decreaseAndDeactivateWhenUsage (unsigned int i)
 first decreases the refCounter then deactivates the RefCounter.
unsigned int getUsage () const

Detailed Description

<class description="" goes="" here=""> <short description="">

Author:
Michael Kropfberger and Peter Schojer
Version:
Id
ReferenceCounter.hpp,v 1.5 2005/04/27 10:21:50 klschoef Exp

Definition at line 61 of file ReferenceCounter.hpp.


Member Function Documentation

void ReferenceCounter::deactivate  ) 
 

deactivates the RefCounter.

Useful, when preparing to destroy the refCounter. Definition at line 99 of file ReferenceCounter.cpp.

00100 { 00101 lock(); 00102 valid=false; usageCnt=0; 00103 unlock(); 00104 };

bool ReferenceCounter::deactivateWhenUsage unsigned int  i  ) 
 

deactivates the RefCounter.

when usage is lower equal

Parameters:
i returns true when refcounter was deactivated
Definition at line 125 of file ReferenceCounter.cpp.
00126 { 00127 lock(); 00128 if(usageCnt<=i) { 00129 valid=false; 00130 usageCnt=0; 00131 } 00132 unlock(); 00133 return !valid; 00134 };

bool ReferenceCounter::decreaseAndDeactivateWhenUsage unsigned int  i  ) 
 

first decreases the refCounter then deactivates the RefCounter.

when usage is lower equal

Parameters:
i 
return is true when refcounter was deactivated
Definition at line 136 of file ReferenceCounter.cpp.
00137 { 00138 lock(); 00139 if(valid && usageCnt>0) { 00140 usageCnt--; 00141 } 00142 if(usageCnt<=i) { 00143 valid=false; 00144 } 00145 unlock(); 00146 return !valid; 00147 };


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