Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
|
Base class for object with reference counter. More...
#include <ref_counted.h>
Public Member Functions | |
RefCounted () | |
Initialize. More... | |
RefCounted (const AllocationPolicy &policy) | |
Initialize. More... | |
int | getref () const |
Get reference counter. More... | |
void | incref () const |
Increment reference counter. More... | |
void | decref () const |
Decrement reference counter. More... | |
Base class for object with reference counter.
Allows to increment and decrement reference counter. When the counter reaches zero, the object is automatically destroyed.
T | defines the derived class. |
AllocationPolicy | defines destroy policy. |
When reference counter becomes zero, AllocationPolicy::destroy() is invoked by RefCounted to destroy itself.
Inherits AllocationPolicy to make its methods and state available in the derived class. E.g., PoolAllocation policy holds a reference to the pool and uses it to release the object.
Thread-safe.
Definition at line 39 of file ref_counted.h.
|
inline |
Initialize.
Definition at line 43 of file ref_counted.h.
|
inlineexplicit |
Initialize.
Definition at line 48 of file ref_counted.h.
|
inline |
Decrement reference counter.
Definition at line 65 of file ref_counted.h.
|
inline |
Get reference counter.
Definition at line 53 of file ref_counted.h.
|
inline |
Increment reference counter.
Definition at line 58 of file ref_counted.h.