Lunchbox
1.6.0
|
Base class for referenced objects. More...
#include <referenced.h>
Public Member Functions | |
void | ref (const void *holder=0) const |
Increase the reference count. | |
bool | unref (const void *holder=0) const |
Decrease the reference count. | |
int | getRefCount () const |
void | printHolders (std::ostream &os) const |
Protected Member Functions | |
Referenced () | |
Construct a new reference-counted object. | |
Referenced (const Referenced &) | |
Construct a new copy of a reference-counted object. | |
virtual | ~Referenced () |
Destruct a reference-counted object. | |
Referenced & | operator= (const Referenced &rhs) |
Assign another object to this object. | |
virtual void | deleteReferenced (const Referenced *) const |
Base class for referenced objects.
Implements reference-counted objects which destroy themselves once they are no longer referenced. Uses an Atomic variable to keep the reference count access thread-safe and efficient.
Definition at line 45 of file referenced.h.
lunchbox::Referenced::Referenced | ( | ) | [inline, protected] |
lunchbox::Referenced::Referenced | ( | const Referenced & | ) | [inline, protected] |
Construct a new copy of a reference-counted object.
Definition at line 131 of file referenced.h.
virtual lunchbox::Referenced::~Referenced | ( | ) | [inline, protected, virtual] |
int lunchbox::Referenced::getRefCount | ( | ) | const [inline] |
Referenced& lunchbox::Referenced::operator= | ( | const Referenced & | rhs | ) | [inline, protected] |
void lunchbox::Referenced::ref | ( | const void * | holder = 0 | ) | const [inline] |
Increase the reference count.
Definition at line 49 of file referenced.h.
References lunchbox::backtrace(), lunchbox::Clock::getTime64(), and lunchbox::Log::instance().
bool lunchbox::Referenced::unref | ( | const void * | holder = 0 | ) | const [inline] |
Decrease the reference count.
The object is deleted when the reference count reaches 0.
Definition at line 78 of file referenced.h.