IReferenceCounters class
Base interface for a reference counter object that stores the number of strong and weak references and the pointer to the object. It is necessary to separate reference counters from the object to support weak pointers.
Contents
- Reference
Public functions
- auto AddStrongRef() -> ReferenceCounterValueType pure virtual
- Increments the number of strong references by 1.
- auto ReleaseStrongRef() -> ReferenceCounterValueType pure virtual
- Decrements the number of strong references by 1 and destroys the referenced object when the counter reaches zero. If there are no more weak references, destroys the reference counters object itself.
- auto AddWeakRef() -> ReferenceCounterValueType pure virtual
- Increments the number of weak references by 1.
- auto ReleaseWeakRef() -> ReferenceCounterValueType pure virtual
- Decrements the number of weak references by 1. If there are no more strong and weak references, destroys the reference counters object itself.
- void GetObject(struct IObject** ppObject) pure virtual
- Gets the pointer to the IUnknown interface of the referenced object.
- auto GetNumStrongRefs() const -> ReferenceCounterValueType pure virtual
- Returns the number of outstanding strong references.
- auto GetNumWeakRefs() const -> ReferenceCounterValueType pure virtual
- Returns the number of outstanding weak references.
Function documentation
ReferenceCounterValueType Diligent:: IReferenceCounters:: AddStrongRef() pure virtual
Increments the number of strong references by 1.
| Returns | The number of strong references after incrementing the counter. |
|---|
ReferenceCounterValueType Diligent:: IReferenceCounters:: ReleaseStrongRef() pure virtual
Decrements the number of strong references by 1 and destroys the referenced object when the counter reaches zero. If there are no more weak references, destroys the reference counters object itself.
| Returns | The number of strong references after decrementing the counter. |
|---|
ReferenceCounterValueType Diligent:: IReferenceCounters:: AddWeakRef() pure virtual
Increments the number of weak references by 1.
| Returns | The number of weak references after incrementing the counter. |
|---|
ReferenceCounterValueType Diligent:: IReferenceCounters:: ReleaseWeakRef() pure virtual
Decrements the number of weak references by 1. If there are no more strong and weak references, destroys the reference counters object itself.
| Returns | The number of weak references after decrementing the counter. |
|---|
ReferenceCounterValueType Diligent:: IReferenceCounters:: GetNumStrongRefs() const pure virtual
Returns the number of outstanding strong references.
| Returns | The number of strong references. |
|---|
ReferenceCounterValueType Diligent:: IReferenceCounters:: GetNumWeakRefs() const pure virtual
Returns the number of outstanding weak references.
| Returns | The number of weak references. |
|---|