#include <atomictypes.h>
Atomic reference counter.
Public Types | |
| using | ValueType = UInt |
Public Member Functions | |
| StrongReferenceCounter () | |
| StrongReferenceCounter (const StrongReferenceCounter &) | |
| void | operator= (const StrongReferenceCounter &) |
| Bool | Inc () |
| Bool | Dec () |
| Bool | ConditionalInc () |
| void | Add (UInt additionalReferences) |
| void | SetRelaxed (UInt referenceCount) |
| operator UInt () const | |
| Bool | HasMultipleReferences () const |
Static Public Member Functions | |
| static const StrongReferenceCounter & | NullValue () |
| static StrongReferenceCounter & | Get (const void *object) |
Protected Attributes | |
| AtomicUInt | _value |
| StrongReferenceCounter | ( | const StrongReferenceCounter & | ) |
| void operator= | ( | const StrongReferenceCounter & | ) |
| Bool Inc | ( | ) |
Increments reference counter (the caller acquires a strong reference).
| Bool Dec | ( | ) |
Decrements reference counter (the caller removes a strong reference).
| Bool ConditionalInc | ( | ) |
Adds a reference if the object is still strongly referenced.
| void Add | ( | UInt | additionalReferences | ) |
Adds references.
| [in] | additionalReferences | The number of additional references to add. |
| void SetRelaxed | ( | UInt | referenceCount | ) |
Sets a specifc reference count - for initialization only!
| operator UInt | ( | ) | const |
Returns the number of strong references to the object.
| Bool HasMultipleReferences | ( | ) | const |
Returns whether an object has more than a single reference. For an object without a reference it will return false. For an object with one reference it will return false. For an object with a single reference and weak references it will return true. For an object with two references it will return true.
|
static |
|
static |
Returns the reference counter for classes which do not implement custom AddReference/RemoveReference methods.
|
protected |