struct TSharedControlBlockWithCustomDeleter

template<typename ObjectType, typename DeleterType, ThreadSafetyPolicy ThreadSafety>

Shared control block that deletes the references object using a user provided deleter.

Public

Constructors

TSharedControlBlockWithCustomDeleter<ObjectType, DeleterType, ThreadSafety>

TSharedControlBlockWithCustomDeleter<ObjectType, DeleterType, ThreadSafety>(ObjectType *object, DeleterType deleter)

Methods

~TSharedControlBlockWithCustomDeleter<ObjectType, DeleterType, ThreadSafety>

~TSharedControlBlockWithCustomDeleter<ObjectType, DeleterType, ThreadSafety>() override

DestroyOwnedObject

void DestroyOwnedObject() override

Destroys the object the control block is pointing to.

DestroySelf

void DestroySelf() override

Destroys the control block.

~TSharedControlBlock<ThreadSafety>

virtual ~TSharedControlBlock<ThreadSafety>() = default

GetStrongReferenceCount

u32 GetStrongReferenceCount() const

Returns the number of currently held strong references.

IncrementStrongReferenceCount

void IncrementStrongReferenceCount()

Increments the strong reference count.

As long as strong reference count is non-zero the owned object will be kept alive.

DecrementStrongReferenceCount

void DecrementStrongReferenceCount()

Decrements the strong reference count.

If the strong reference count reaches zero the owned object will be destroyed. Additionally if there are no weak resource handles alive either, control block data will be destroyed.

IncrementWeakReferenceCount

void IncrementWeakReferenceCount()

Increments the weak reference count.

This keeps the control block data alive, but not the owned object itself.

DecrementWeakReferenceCount

void DecrementWeakReferenceCount()

Decrements the weak reference count.

If this was the last weak reference and there are no strong references either, control block data will be destroyed.

IncrementStrongReferenceCountIfNonZero

bool IncrementStrongReferenceCountIfNonZero()

Increments the strong reference count, but only if it is not already at zero.

Returns true if incremented.

Private

Fields

mDeleterAndObject

CompressedPair<DeleterType, ObjectType *> mDeleterAndObject