engine
 
载入中...
搜索中...
未找到
Public 成员函数 | 友元 | 所有成员列表
FWeakObjectPtr结构体 参考

FWeakObjectPtr is a weak pointer to a UObject. 更多...

#include <WeakObjectPtr.h>

Public 成员函数

FORCEINLINE FWeakObjectPtr ()
 Null constructor
 
FORCEINLINE FWeakObjectPtr (const class UObject *Object)
 Construct from an object pointer 更多...
 
 FWeakObjectPtr (const FWeakObjectPtr &Other)=default
 Construct from another weak pointer 更多...
 
COREUOBJECT_API class UObject * Get () const
 Dereference the weak pointer. 更多...
 
COREUOBJECT_API class UObject * Get (bool bEvenIfPendingKill) const
 Dereference the weak pointer. 更多...
 
COREUOBJECT_API class UObject * GetEvenIfUnreachable () const
 Dereference the weak pointer even if it is RF_PendingKill or RF_Unreachable
 
FORCEINLINE bool HasSameIndexAndSerialNumber (const FWeakObjectPtr &Other) const
 Returns true if two weak pointers were originally set to the same object, even if they are now stale 更多...
 
FORCEINLINE bool IsExplicitlyNull () const
 Returns true if this pointer was explicitly assigned to null, was reset, or was never initialized. 更多...
 
COREUOBJECT_API bool IsStale (bool bIncludingIfPendingKill=true, bool bThreadsafeTest=false) const
 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. 更多...
 
COREUOBJECT_API bool IsValid () const
 Test if this points to a live UObject. 更多...
 
COREUOBJECT_API bool IsValid (bool bEvenIfPendingKill, bool bThreadsafeTest=false) const
 Test if this points to a live UObject 更多...
 
FORCEINLINE bool operator!= (const FWeakObjectPtr &Other) const
 Compare weak pointers for inequality 更多...
 
COREUOBJECT_API void operator= (const class UObject *Object)
 Copy from an object pointer 更多...
 
FWeakObjectPtr & operator= (const FWeakObjectPtr &Other)=default
 Construct from another weak pointer 更多...
 
FORCEINLINE bool operator== (const FWeakObjectPtr &Other) const
 Compare weak pointers for equality. 更多...
 
FORCEINLINE void Reset ()
 Reset the weak pointer back to the null state
 
COREUOBJECT_API void Serialize (FArchive &Ar)
 Weak object pointer serialization. 更多...
 

友元

struct FObjectKey
 
uint32 GetTypeHash (const FWeakObjectPtr &WeakObjectPtr)
 Hash function.
 
template<typename ReferenceProcessorType , typename CollectorType , typename ArrayPoolType , EFastReferenceCollectorOptions Options>
class TFastReferenceCollector
 

详细描述

FWeakObjectPtr is a weak pointer to a UObject.

It can return nullptr later if the object is garbage collected. It has no impact on if the object is garbage collected or not. It can't be directly used across a network.

Most often it is used when you explicitly do NOT want to prevent something from being garbage collected.

构造及析构函数说明

◆ FWeakObjectPtr() [1/2]

FORCEINLINE FWeakObjectPtr::FWeakObjectPtr ( const class UObject *  Object)
inline

Construct from an object pointer

参数
Objectobject to create a weak pointer to

◆ FWeakObjectPtr() [2/2]

FWeakObjectPtr::FWeakObjectPtr ( const FWeakObjectPtr &  Other)
default

Construct from another weak pointer

参数
Otherweak pointer to copy from

成员函数说明

◆ Get() [1/2]

COREUOBJECT_API class UObject * FWeakObjectPtr::Get ( ) const

Dereference the weak pointer.

This is an optimized version implying bEvenIfPendingKill=false.

返回
nullptr if this object is gone or the weak pointer is explicitly null, otherwise a valid uobject pointer

◆ Get() [2/2]

COREUOBJECT_API class UObject * FWeakObjectPtr::Get ( bool  bEvenIfPendingKill) const

Dereference the weak pointer.

参数
bEvenIfPendingKillif this is true, pendingkill objects are considered valid
返回
nullptr if this object is gone or the weak pointer is explicitly null, otherwise a valid uobject pointer

◆ HasSameIndexAndSerialNumber()

FORCEINLINE bool FWeakObjectPtr::HasSameIndexAndSerialNumber ( const FWeakObjectPtr &  Other) const
inline

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

参数
Otherweak pointer to compare to

◆ IsExplicitlyNull()

FORCEINLINE bool FWeakObjectPtr::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.

◆ IsStale()

COREUOBJECT_API bool FWeakObjectPtr::IsStale ( bool  bIncludingIfPendingKill = true,
bool  bThreadsafeTest = false 
) const

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.

参数
bIncludingIfPendingKillif this is false, pendingkill objects are not 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)
返回
true if this used to point at a real object but no longer does.

◆ IsValid() [1/2]

COREUOBJECT_API bool FWeakObjectPtr::IsValid ( ) const

Test if this points to a live UObject.

This is an optimized version implying bEvenIfPendingKill=false, bThreadsafeTest=false.

返回
true if Get() would return a valid non-null pointer.

◆ IsValid() [2/2]

COREUOBJECT_API bool FWeakObjectPtr::IsValid ( bool  bEvenIfPendingKill,
bool  bThreadsafeTest = false 
) const

Test if this points to a live UObject

参数
bEvenIfPendingKillif this is true, pendingkill are not considered invalid
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).
返回
true if Get() would return a valid non-null pointer

◆ operator!=()

FORCEINLINE bool FWeakObjectPtr::operator!= ( const FWeakObjectPtr &  Other) const
inline

Compare weak pointers for inequality

参数
Otherweak pointer to compare to

◆ operator=() [1/2]

COREUOBJECT_API void FWeakObjectPtr::operator= ( const class UObject *  Object)

Copy from an object pointer

参数
Objectobject to create a weak pointer to

◆ operator=() [2/2]

FWeakObjectPtr & FWeakObjectPtr::operator= ( const FWeakObjectPtr &  Other)
default

Construct from another weak pointer

参数
Otherweak pointer to copy from

◆ operator==()

FORCEINLINE bool FWeakObjectPtr::operator== ( const FWeakObjectPtr &  Other) 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.

参数
Otherweak pointer to compare to

◆ Serialize()

COREUOBJECT_API void FWeakObjectPtr::Serialize ( FArchive &  Ar)

Weak object pointer serialization.

Weak object pointers only have weak references to objects and won't serialize the object when gathering references for garbage collection. So in many cases, you don't need to bother serializing weak object pointers. However, serialization is required if you want to load and save your object.


该结构体的文档由以下文件生成: