#include <ref_counted.hpp>
This class implements intrusive reference counting to use derived classes in a boost::intrusive_ptr
.
hamcast::ref_counted::ref_counted |
( |
| ) |
|
|
protected |
Initializes the reference count with 0.
static void hamcast::ref_counted::add_ref |
( |
ref_counted * |
rc | ) |
|
|
static |
Convenience function that increments the reference count of rc
.
Equal to if (rc) rc->ref();
- Parameters
-
rc | A native pointer to a reference counted object. |
bool hamcast::ref_counted::deref |
( |
| ) |
|
|
protected |
Atomically decrement the reference count.
- Returns
- true if there are still references to this object; otherwise false.
void hamcast::ref_counted::ref |
( |
| ) |
|
|
protected |
Atomically increment the reference count.
long hamcast::ref_counted::ref_count |
( |
| ) |
|
Get the current reference count.
- Returns
- The current reference count as long.
static void hamcast::ref_counted::release |
( |
ref_counted * |
rc | ) |
|
|
static |
Convenience function that decrements the reference count of rc
and deletes rc
if needed.
Equal to if (rc && !rc->deref()) delete rc;
- Parameters
-
rc | A native pointer to a reference counted object. |
The documentation for this class was generated from the following files:
- hamcast/ref_counted.hpp
- src/ref_counted.cpp