ADTF
3.18.5
|
Default implementation of a reference counter. More...
Public Member Functions | |
template<typename... Args> | |
ReferenceCountedObject (Args &&... args) | |
CTOR constructing the managed resource and the reference counter to an initial value of zero. More... | |
virtual void | addReference () const |
Increase the reference count by 1. | |
virtual void | removeReference () const |
Decrease the reference count by 1, deleting *this if it was the last reference. | |
virtual const Interface & | getObject () const |
Get a reference to the handled object's interface - provided for const correctness. More... | |
virtual Interface & | getObject () |
Get a reference to the handled object's interface. More... | |
Private Member Functions | |
ReferenceCountedObject (const ReferenceCountedObject &) | |
ReferenceCountedObject & | operator= (const ReferenceCountedObject &) |
Private Attributes | |
std::atomic< std::int32_t > | _reference_count |
Reference to count atomically. | |
Implementation | _resource |
Resource to manage. | |
Additional Inherited Members | |
Protected Member Functions inherited from ReferenceCountedObjectInterface< Interface > | |
~ReferenceCountedObjectInterface () | |
DTOR. | |
Default implementation of a reference counter.
Interface | The interface of the resource to handle |
Implementation | The type implementing the Interface type |
Definition at line 33 of file reference_counted_object.h.
|
inline |
CTOR constructing the managed resource and the reference counter to an initial value of zero.
Args | Argument types of the resource's constructor |
[in] | args | Values to forward to the resource's constructor |
Definition at line 45 of file reference_counted_object.h.
|
inlinevirtual |
Get a reference to the handled object's interface.
Implements ReferenceCountedObjectInterface< Interface >.
Definition at line 79 of file reference_counted_object.h.
References ReferenceCountedObject< Interface, Implementation >::_resource.
|
inlinevirtual |
Get a reference to the handled object's interface - provided for const correctness.
Implements ReferenceCountedObjectInterface< Interface >.
Definition at line 70 of file reference_counted_object.h.
References ReferenceCountedObject< Interface, Implementation >::_resource.