SourcePro® API Reference Guide

 
List of all members | Public Member Functions
RWTCounter< Mutex > Class Template Reference

Deprecated. Maintains a reference count. More...

#include <rw/pointer/RWTCounter.h>

Inheritance diagram for RWTCounter< Mutex >:
RWTCountingBody< Mutex > RWTMonitor< Mutex >

Public Member Functions

 RWTCounter (unsigned initCount=0)
 
 RWTCounter (RWStaticCtor)
 
 RWTCounter (const RWTCounter< Mutex > &second)
 
RWTCounter< Mutex > & operator= (const RWTCounter< Mutex > &second)
 
- Public Member Functions inherited from RWTCountingBody< Mutex >
 ~RWTCountingBody (void)
 
unsigned addReference (void)
 
unsigned references (void) const
 
unsigned removeReference (void)
 

Additional Inherited Members

- Protected Types inherited from RWTCountingBody< Mutex >
typedef RWTLockGuard< RWTMonitor< Mutex > > LockGuard
 
typedef RWTTryLockGuard< RWTMonitor< Mutex > > TryLockGuard
 
typedef RWTUnlockGuard< RWTMonitor< Mutex > > UnlockGuard
 
- Protected Types inherited from RWTMonitor< Mutex >
typedef RWTLockGuard< RWTMonitor< Mutex > > LockGuard
 
typedef RWTTryLockGuard< RWTMonitor< Mutex > > TryLockGuard
 
typedef RWTUnlockGuard< RWTMonitor< Mutex > > UnlockGuard
 
- Protected Member Functions inherited from RWTCountingBody< Mutex >
 RWTCountingBody (unsigned initCount=0)
 
 RWTCountingBody (RWStaticCtor)
 
 RWTCountingBody (const RWTCountingBody< Mutex > &second)
 
RWTCountingBody< Mutex > & operator= (const RWTCountingBody< Mutex > &second)
 
- Protected Member Functions inherited from RWTMonitor< Mutex >
 RWTMonitor ()
 
 RWTMonitor (RWStaticCtor)
 
 RWTMonitor (const RWTMonitor< Mutex > &second)
 
 ~RWTMonitor ()
 
void acquire ()
 
bool isAcquired () const
 
RWTMonitor< Mutex > & monitor () const
 
Mutex & mutex ()
 
RWTMonitor< Mutex > & operator= (const RWTMonitor< Mutex > &)
 
void release ()
 
bool tryAcquire ()
 

Detailed Description

template<class Mutex>
class RWTCounter< Mutex >

Deprecated:
As of SourcePro 11.1, use RWAtomicCounter.

A class for maintaining a reference count that uses the template type as a lock for atomicity.

Generally, applications will use one of two typedefs provided by the Smart Pointer package. RWSafeCounter is a typedef for RWTCounter<RWMutexLock> and provides thread-safe reference counting. RWUnsafeCounter is a typedef for RWTCounter<RWNullMutexLock> and can be used for greater efficiency when thread safety is not required.

See also
RWSafeCounter, RWUnsafeCounter, RWTCountingPointer

Constructor & Destructor Documentation

template<class Mutex >
RWTCounter< Mutex >::RWTCounter ( unsigned  initCount = 0)
inline

Constructs a default instance (initializes the reference count). Throws no exceptions.

template<class Mutex >
RWTCounter< Mutex >::RWTCounter ( RWStaticCtor  )
inline

Constructs a static instance (does not initialize the reference count). Throws no exceptions.

template<class Mutex >
RWTCounter< Mutex >::RWTCounter ( const RWTCounter< Mutex > &  second)
inline

Does not copy the internal count. This method is provided as a convenience to derived classes.

Member Function Documentation

template<class Mutex >
RWTCounter< Mutex > & RWTCounter< Mutex >::operator= ( const RWTCounter< Mutex > &  second)
inline

Does not assign the internal count. This method is provided as a convenience to derived classes.

Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.