lean cpp library
A lean C++ library providing efficient utility classes for high-performance C++ applications.
|
Reference counter class that maintains strong and weak reference counts. More...
#include <ref_counter.h>
Classes | |
class | ref_counts |
Reference counter structure. More... | |
Public Types | |
typedef Counter | counter_type |
Type of the counter used by this class. | |
typedef Allocator | allocator_type |
Type of the allocator used by this class. | |
Public Member Functions | |
void | release (ref_counts *counts) |
Releases the given internal reference counting object. | |
ref_counter (ref_counts *counts) | |
Special constructor. | |
ref_counter (counter_type references=1) | |
Constructor. | |
ref_counter (allocator_type allocator) | |
Constructor. | |
ref_counter (counter_type references, allocator_type allocator) | |
Constructor. | |
ref_counter (const ref_counter &refCounter) | |
Copy constructor. | |
~ref_counter () throw () | |
Destructor. | |
ref_counter & | operator= (const ref_counter &refCounter) |
Assignment operator. [ESA] | |
bool | increment_checked () const |
Increments the current reference count. | |
counter_type | increment () const |
Increments the current reference count. | |
counter_type | decrement () const |
Decrements the current reference count. | |
LEAN_INLINE bool | is_null () |
Checks whether this reference counter is in a valid state. | |
LEAN_INLINE counter_type | count () const |
Gets the current reference count. | |
LEAN_INLINE bool | valid () const |
Gets whether the reference-counted object still exists (<==> reference count > 0). | |
LEAN_INLINE counter_type | weak_count () const |
Gets the current weak reference count. | |
LEAN_INLINE ref_counter & | operator++ () |
Increments the current reference count. | |
LEAN_INLINE const ref_counter & | operator++ () const |
Increments the current reference count. | |
LEAN_INLINE ref_counter & | operator-- () |
Decrements the current reference count. | |
LEAN_INLINE const ref_counter & | operator-- () const |
Decrements the current reference count. | |
LEAN_INLINE counter_type | operator++ (int) const |
Increments the current reference count. | |
LEAN_INLINE counter_type | operator-- (int) const |
Decrements the current reference count. | |
LEAN_INLINE | operator counter_type () const |
Gets the current reference count. | |
LEAN_INLINE | operator bool () const |
Gets whether the reference-counted object still exists (<==> reference count > 0). | |
Static Public Member Functions | |
static ref_counts * | acquire (ref_counts *counts) |
Acquires the given internal reference counting object. | |
static LEAN_INLINE ref_counter | null () |
Gets a null reference counter that may only be copied from and assigned to. | |
Public Attributes | |
ref_counts * | m_counts |
Reference counter class that maintains strong and weak reference counts.