Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
TWeakObjectPtr< T > Struct Template Reference

#include <UE.h>

+ Inheritance diagram for TWeakObjectPtr< T >:
+ Collaboration diagram for TWeakObjectPtr< T >:

Public Types

using ElementType = T
 

Public Member Functions

FORCEINLINE Toperator* ()
 
FORCEINLINE Toperator-> ()
 
TGet (bool bEvenIfPendingKill=false)
 
FORCEINLINE operator bool ()
 
FORCEINLINE operator T* ()
 
FORCEINLINE bool operator== (const TWeakObjectPtr< T > &__that) const
 
 TWeakObjectPtr ()
 
 TWeakObjectPtr (int index, int serialnumber)
 
 TWeakObjectPtr ()=default
 
 TWeakObjectPtr (const TWeakObjectPtr &)=default
 
TWeakObjectPtroperator= (const TWeakObjectPtr &)=default
 
 ~TWeakObjectPtr ()=default
 
FORCEINLINE TWeakObjectPtr (TYPE_OF_NULLPTR)
 
template<typename U , decltype(ImplicitConv< T * >(std::declval< U >())) * = nullptr>
FORCEINLINE TWeakObjectPtr (U Object)
 
template<typename OtherT , typename = decltype(ImplicitConv<T*>((OtherT*)nullptr))>
FORCEINLINE TWeakObjectPtr (const TWeakObjectPtr< OtherT, TWeakObjectPtrBase > &Other)
 
FORCEINLINE void Reset ()
 
template<class U >
FORCEINLINE TEnableIf<!TLosesQualifiersFromTo< U, T >::Value, TWeakObjectPtr & >::Type operator= (U *Object)
 
template<typename OtherT , typename = decltype(ImplicitConv<T*>((OtherT*)nullptr))>
FORCEINLINE TWeakObjectPtroperator= (const TWeakObjectPtr< OtherT, TWeakObjectPtrBase > &Other)
 
FORCEINLINE TGet (bool bEvenIfPendingKill) const
 
FORCEINLINE TGet () const
 
FORCEINLINE TGetEvenIfUnreachable () const
 
FORCEINLINE Toperator* () const
 
FORCEINLINE Toperator-> () const
 
 operator bool () const =delete
 
FORCEINLINE bool IsValid (bool bEvenIfPendingKill, bool bThreadsafeTest=false) const
 
FORCEINLINE bool IsValid () const
 
FORCEINLINE bool IsStale (bool bIncludingIfPendingKill=true, bool bThreadsafeTest=false) const
 
FORCEINLINE bool IsExplicitlyNull () const
 
FORCEINLINE bool HasSameIndexAndSerialNumber (const TWeakObjectPtr &Other) const
 
FORCEINLINE void Serialize (FArchive &Ar)
 
FORCEINLINE uint32 GetWeakPtrTypeHash () const
 
template<typename RhsT , typename = decltype((T*)nullptr == (RhsT*)nullptr)>
FORCENOINLINE bool operator== (const TWeakObjectPtr< RhsT, TWeakObjectPtrBase > &Rhs) const
 
template<typename RhsT , typename = decltype((T*)nullptr == (RhsT*)nullptr)>
FORCENOINLINE bool operator== (const RhsT *Rhs) const
 
FORCENOINLINE bool operator== (TYPE_OF_NULLPTR) const
 
template<typename RhsT , typename = decltype((T*)nullptr != (RhsT*)nullptr)>
FORCENOINLINE bool operator!= (const TWeakObjectPtr< RhsT, TWeakObjectPtrBase > &Rhs) const
 
template<typename RhsT , typename = decltype((T*)nullptr != (RhsT*)nullptr)>
FORCENOINLINE bool operator!= (const RhsT *Rhs) const
 
FORCENOINLINE bool operator!= (TYPE_OF_NULLPTR) const
 

Public Attributes

int ObjectIndex = 0
 
int ObjectSerialNumber = 0
 

Friends

struct FFieldPath
 

Detailed Description

template<typename T>
struct TWeakObjectPtr< T >

TWeakObjectPtr is the templated version of the generic FWeakObjectPtr

Definition at line 22 of file UE.h.

Member Typedef Documentation

◆ ElementType

template<typename T >
using TWeakObjectPtr< T >::ElementType = T

Definition at line 40 of file WeakObjectPtrTemplates.h.

Constructor & Destructor Documentation

◆ TWeakObjectPtr() [1/7]

template<typename T >
TWeakObjectPtr< T >::TWeakObjectPtr ( )
inline

Definition at line 58 of file UE.h.

◆ TWeakObjectPtr() [2/7]

template<typename T >
TWeakObjectPtr< T >::TWeakObjectPtr ( int index,
int serialnumber )
inline

Definition at line 61 of file UE.h.

◆ TWeakObjectPtr() [3/7]

template<typename T >
TWeakObjectPtr< T >::TWeakObjectPtr ( )
default

◆ TWeakObjectPtr() [4/7]

◆ ~TWeakObjectPtr()

template<typename T >
TWeakObjectPtr< T >::~TWeakObjectPtr ( )
default

◆ TWeakObjectPtr() [5/7]

Construct from a null pointer

Definition at line 50 of file WeakObjectPtrTemplates.h.

◆ TWeakObjectPtr() [6/7]

template<typename T >
template<typename U , decltype(ImplicitConv< T * >(std::declval< U >())) * = nullptr>
FORCEINLINE TWeakObjectPtr< T >::TWeakObjectPtr ( U Object)
inline

Construct from an object pointer

Parameters
Objectobject to create a weak pointer to

Definition at line 63 of file WeakObjectPtrTemplates.h.

◆ TWeakObjectPtr() [7/7]

template<typename T >
template<typename OtherT , typename = decltype(ImplicitConv<T*>((OtherT*)nullptr))>
FORCEINLINE TWeakObjectPtr< T >::TWeakObjectPtr ( const TWeakObjectPtr< OtherT, TWeakObjectPtrBase > & Other)
inline

Construct from another weak pointer of another type, intended for derived-to-base conversions

Parameters
Otherweak pointer to copy from

Definition at line 79 of file WeakObjectPtrTemplates.h.

Member Function Documentation

◆ Get() [1/3]

template<typename T >
FORCEINLINE T * TWeakObjectPtr< T >::Get ( ) const
inline

Dereference the weak pointer. This is an optimized version implying bEvenIfPendingKill=false.

Definition at line 132 of file WeakObjectPtrTemplates.h.

◆ Get() [2/3]

template<typename T >
FORCEINLINE T * TWeakObjectPtr< T >::Get ( bool bEvenIfPendingKill) const
inline

Dereference the weak pointer

Parameters
bEvenIfPendingKillif this is true, pendingkill objects are considered valid
Returns
nullptr if this object is gone or the weak pointer is explicitly null, otherwise a valid uobject pointer

Definition at line 124 of file WeakObjectPtrTemplates.h.

◆ Get() [3/3]

template<typename T >
T * TWeakObjectPtr< T >::Get ( bool bEvenIfPendingKill = false)
inline

Definition at line 37 of file UE.h.

◆ GetEvenIfUnreachable()

template<typename T >
FORCEINLINE T * TWeakObjectPtr< T >::GetEvenIfUnreachable ( ) const
inline

Deferences the weak pointer even if its marked RF_Unreachable. This is needed to resolve weak pointers during GC (such as ::AddReferenceObjects)

Definition at line 138 of file WeakObjectPtrTemplates.h.

◆ GetWeakPtrTypeHash()

template<typename T >
FORCEINLINE uint32 TWeakObjectPtr< T >::GetWeakPtrTypeHash ( ) const
inline

Hash function.

Definition at line 228 of file WeakObjectPtrTemplates.h.

◆ HasSameIndexAndSerialNumber()

template<typename T >
FORCEINLINE bool TWeakObjectPtr< T >::HasSameIndexAndSerialNumber ( const TWeakObjectPtr< T > & Other) const
inline

Returns true if two weak pointers were originally set to the same object, even if they are now stale

Parameters
Otherweak pointer to compare to

Definition at line 214 of file WeakObjectPtrTemplates.h.

◆ IsExplicitlyNull()

template<typename T >
FORCEINLINE bool TWeakObjectPtr< T >::IsExplicitlyNull ( ) const
inline

Returns true if this pointer was explicitly assigned to null, was reset, or was never initialized. If this returns true, IsValid() and IsStale() will both return false.

Definition at line 205 of file WeakObjectPtrTemplates.h.

◆ IsStale()

template<typename T >
FORCEINLINE bool TWeakObjectPtr< T >::IsStale ( bool bIncludingIfPendingKill = true,
bool bThreadsafeTest = false ) const
inline

Slightly different than !IsValid(), returns true if this used to point to a UObject, but doesn't any more and has not been assigned or reset in the mean time.

Parameters
bIncludingIfPendingKillif this is true, pendingkill objects are considered stale
bThreadsafeTestset it to true when testing outside of Game Thread. Results in false if WeakObjPtr point to an existing object (no flags checked)
Returns
true if this used to point at a real object but no longer does.

Definition at line 196 of file WeakObjectPtrTemplates.h.

◆ IsValid() [1/2]

template<typename T >
FORCEINLINE bool TWeakObjectPtr< T >::IsValid ( ) const
inline

Test if this points to a live UObject. This is an optimized version implying bEvenIfPendingKill=false, bThreadsafeTest=false. This should be done only when needed as excess resolution of the underlying pointer can cause performance issues. Note that IsValid can not be used on another thread as it will incorrectly return false during the mark phase of the GC due to the Unreachable flag being set. (see bThreadsafeTest above)

Returns
true if Get() would return a valid non-null pointer

Definition at line 185 of file WeakObjectPtrTemplates.h.

◆ IsValid() [2/2]

template<typename T >
FORCEINLINE bool TWeakObjectPtr< T >::IsValid ( bool bEvenIfPendingKill,
bool bThreadsafeTest = false ) const
inline

Test if this points to a live UObject. This should be done only when needed as excess resolution of the underlying pointer can cause performance issues.

Parameters
bEvenIfPendingKillif this is true, pendingkill objects are considered valid
bThreadsafeTestif true then function will just give you information whether referenced UObject is gone forever (return false) or if it is still there (return true, no object flags checked). This is required as without it IsValid can return false during the mark phase of the GC due to the presence of the Unreachable flag.
Returns
true if Get() would return a valid non-null pointer

Definition at line 173 of file WeakObjectPtrTemplates.h.

◆ operator bool() [1/2]

Definition at line 42 of file UE.h.

◆ operator bool() [2/2]

template<typename T >
TWeakObjectPtr< T >::operator bool ( ) const
explicitdelete

◆ operator T*()

template<typename T >
FORCEINLINE TWeakObjectPtr< T >::operator T* ( )
inline

Definition at line 47 of file UE.h.

◆ operator!=() [1/3]

template<typename T >
template<typename RhsT , typename = decltype((T*)nullptr != (RhsT*)nullptr)>
FORCENOINLINE bool TWeakObjectPtr< T >::operator!= ( const RhsT * Rhs) const
inline

Definition at line 268 of file WeakObjectPtrTemplates.h.

◆ operator!=() [2/3]

template<typename T >
template<typename RhsT , typename = decltype((T*)nullptr != (RhsT*)nullptr)>
FORCENOINLINE bool TWeakObjectPtr< T >::operator!= ( const TWeakObjectPtr< RhsT, TWeakObjectPtrBase > & Rhs) const
inline

Compare weak pointers for inequality

Parameters
Otherweak pointer to compare to

Definition at line 262 of file WeakObjectPtrTemplates.h.

◆ operator!=() [3/3]

template<typename T >
FORCENOINLINE bool TWeakObjectPtr< T >::operator!= ( TYPE_OF_NULLPTR ) const
inline

Definition at line 274 of file WeakObjectPtrTemplates.h.

◆ operator*() [1/2]

template<typename T >
FORCEINLINE T & TWeakObjectPtr< T >::operator* ( )
inline

Definition at line 27 of file UE.h.

◆ operator*() [2/2]

template<typename T >
FORCEINLINE T & TWeakObjectPtr< T >::operator* ( ) const
inline

Dereference the weak pointer

Definition at line 146 of file WeakObjectPtrTemplates.h.

◆ operator->() [1/2]

template<typename T >
FORCEINLINE T * TWeakObjectPtr< T >::operator-> ( )
inline

Definition at line 32 of file UE.h.

◆ operator->() [2/2]

template<typename T >
FORCEINLINE T * TWeakObjectPtr< T >::operator-> ( ) const
inline

Dereference the weak pointer

Definition at line 154 of file WeakObjectPtrTemplates.h.

◆ operator=() [1/3]

◆ operator=() [2/3]

template<typename T >
template<typename OtherT , typename = decltype(ImplicitConv<T*>((OtherT*)nullptr))>
FORCEINLINE TWeakObjectPtr & TWeakObjectPtr< T >::operator= ( const TWeakObjectPtr< OtherT, TWeakObjectPtrBase > & Other)
inline

Assign from another weak pointer, intended for derived-to-base conversions

Parameters
Otherweak pointer to copy from

Definition at line 112 of file WeakObjectPtrTemplates.h.

◆ operator=() [3/3]

template<typename T >
template<class U >
FORCEINLINE TEnableIf<!TLosesQualifiersFromTo< U, T >::Value, TWeakObjectPtr & >::Type TWeakObjectPtr< T >::operator= ( U * Object)
inline

Copy from an object pointer

Parameters
Objectobject to create a weak pointer to

Definition at line 97 of file WeakObjectPtrTemplates.h.

◆ operator==() [1/4]

template<typename T >
template<typename RhsT , typename = decltype((T*)nullptr == (RhsT*)nullptr)>
FORCENOINLINE bool TWeakObjectPtr< T >::operator== ( const RhsT * Rhs) const
inline

Definition at line 245 of file WeakObjectPtrTemplates.h.

◆ operator==() [2/4]

template<typename T >
template<typename RhsT , typename = decltype((T*)nullptr == (RhsT*)nullptr)>
FORCENOINLINE bool TWeakObjectPtr< T >::operator== ( const TWeakObjectPtr< RhsT, TWeakObjectPtrBase > & Rhs) const
inline

Compare weak pointers for equality. If both pointers would return nullptr from Get() they count as equal even if they were not initialized to the same object.

Parameters
Otherweak pointer to compare to

Definition at line 239 of file WeakObjectPtrTemplates.h.

◆ operator==() [3/4]

template<typename T >
FORCEINLINE bool TWeakObjectPtr< T >::operator== ( const TWeakObjectPtr< T > & __that) const
inline

Definition at line 52 of file UE.h.

◆ operator==() [4/4]

Definition at line 251 of file WeakObjectPtrTemplates.h.

◆ Reset()

template<typename T >
FORCEINLINE void TWeakObjectPtr< T >::Reset ( )
inline

Reset the weak pointer back to the null state

Definition at line 87 of file WeakObjectPtrTemplates.h.

◆ Serialize()

template<typename T >
FORCEINLINE void TWeakObjectPtr< T >::Serialize ( FArchive & Ar)
inline

Weak object pointer serialization, this forwards to FArchive::operator<<(struct FWeakObjectPtr&) or an override

Definition at line 222 of file WeakObjectPtrTemplates.h.

Friends And Related Symbol Documentation

◆ FFieldPath

template<typename T >
friend struct FFieldPath
friend

Definition at line 33 of file WeakObjectPtrTemplates.h.

Member Data Documentation

◆ ObjectIndex

template<typename T >
int TWeakObjectPtr< T >::ObjectIndex = 0

Definition at line 24 of file UE.h.

◆ ObjectSerialNumber

template<typename T >
int TWeakObjectPtr< T >::ObjectSerialNumber = 0

Definition at line 25 of file UE.h.


The documentation for this struct was generated from the following files: