Ocean
|
This class implements a helper object for the actual object reference class. More...
Public Member Functions | |
ObjectHolder (T *object, const ReleaseCallback &releaseCallback=ReleaseCallback()) | |
Creates a new ObjectHolder object. More... | |
ObjectHolder * | ref () |
Increases the reference counter. More... | |
void | unref () |
Decreases the reference counter and disposes the encapsulated object and the holder itself if the reference counter reaches zero. More... | |
unsigned int | references () const |
Returns the number of references. More... | |
Protected Attributes | |
T * | object_ = nullptr |
Pointer to the internal object. More... | |
std::atomic< unsigned int > | atomicReferenceCounter_ |
Reference counter of the internal object. More... | |
ReleaseCallback | callback_ |
Release callback. More... | |
Friends | |
class | ObjectRef< T > |
This class implements a helper object for the actual object reference class.
ObjectRef objects sharing the same encapsulated object share the same holder object of the encapsulated object. The holder is created only once for the very first ObjectRef object, while the pointer to this holder is shared to the subsequent ObjectRef objects (which access the same encapsulated object).
|
inlineexplicit |
Creates a new ObjectHolder object.
object | Pointer to the internal object |
releaseCallback | Callback for release event |
|
inline |
Increases the reference counter.
|
inline |
Returns the number of references.
void Ocean::ObjectRef< T >::ObjectHolder::unref |
Decreases the reference counter and disposes the encapsulated object and the holder itself if the reference counter reaches zero.
|
friend |
|
protected |
Reference counter of the internal object.
|
protected |
Release callback.
|
protected |
Pointer to the internal object.