6#include "HAL/PlatformAtomics.h"
7#include "HAL/PreprocessorHelpers.h"
8#include "HAL/ThreadSafeCounter.h"
9#include "Misc/AssertionMacros.h"
10#include "Misc/Build.h"
11#include "Serialization/Archive.h"
12#include "Serialization/MemoryLayout.h"
13#include "Templates/TypeHash.h"
26
27
39 return uint32(FPlatformAtomics::InterlockedIncrement(&NumRefs));
51 const int32 Refs = FPlatformAtomics::InterlockedDecrement(&NumRefs);
72
73
74
75
76
77
91 uint32 Refs = uint32(--
NumRefs);
107
108
140
141
142template<
typename ReferencedType>
171 template<
typename CopyReferencedType>
187 template<
typename MoveReferencedType>
226 template<
typename CopyReferencedType>
247 template<
typename MoveReferencedType>
329 template <
typename OtherType>
347template<
typename ReferencedType>
350 return A == B.GetReference();
354template<
typename ReferencedType>
357 return GetTypeHash(InPtr.GetReference());
361template<
typename ReferencedType>
#define ALIAS_TEMPLATE_TYPE_LAYOUT(TemplatePrefix, T, Alias)
FORCEINLINE uint32 GetTypeHash(const TRefCountPtr< ReferencedType > &InPtr)
FORCEINLINE bool operator==(ReferencedType *A, const TRefCountPtr< ReferencedType > &B)
uint32 GetRefCount() const
FRefCountBase(const FRefCountBase &Rhs)=delete
void CheckRefCount() const
virtual ~FRefCountBase()=default
FRefCountBase & operator=(const FRefCountBase &Rhs)=delete
virtual ~FRefCountedObject()
FRefCountedObject & operator=(const FRefCountedObject &Rhs)=delete
FRefCountedObject(const FRefCountedObject &Rhs)=delete
uint32 GetRefCount() const
FThreadSafeCounter(int32 Value)
virtual ~FThreadSafeRefCountedObject()
FThreadSafeRefCountedObject()
uint32 GetRefCount() const
FThreadSafeCounter NumRefs
FThreadSafeRefCountedObject(const FThreadSafeRefCountedObject &Rhs)=delete
FThreadSafeRefCountedObject & operator=(const FThreadSafeRefCountedObject &Rhs)=delete
virtual uint32 AddRef() const =0
virtual uint32 GetRefCount() const =0
virtual ~IRefCountedObject()
virtual uint32 Release() const =0
TRefCountPtr(TRefCountPtr< MoveReferencedType > &&Move)
ReferencedType * ReferenceType
ReferencedType * Reference
void Serialize(FArchive &Ar)
TRefCountPtr(const TRefCountPtr &Copy)
TRefCountPtr & operator=(ReferencedType *InReference)
FORCEINLINE friend bool IsValidRef(const TRefCountPtr &InReference)
FORCEINLINE operator ReferenceType() const
FORCEINLINE void SafeRelease()
TRefCountPtr(const TRefCountPtr< CopyReferencedType > &Copy)
TRefCountPtr & operator=(TRefCountPtr< MoveReferencedType > &&InPtr)
TRefCountPtr & operator=(TRefCountPtr &&InPtr)
FORCEINLINE TRefCountPtr & operator=(const TRefCountPtr< CopyReferencedType > &InPtr)
FORCEINLINE bool operator==(ReferencedType *B) const
FORCEINLINE TRefCountPtr()
FORCEINLINE TRefCountPtr & operator=(const TRefCountPtr &InPtr)
FORCEINLINE bool IsValid() const
FORCEINLINE ReferencedType ** GetInitReference()
FORCEINLINE TRefCountPtr(TRefCountPtr &&Move)
FORCEINLINE bool operator==(const TRefCountPtr &B) const
TRefCountPtr(ReferencedType *InReference, bool bAddRef=true)
FORCEINLINE ReferencedType * GetReference() const
FORCEINLINE void Swap(TRefCountPtr &InPtr)
FORCEINLINE ReferencedType * operator->() const