engine
 
载入中...
搜索中...
未找到
Public 成员函数 | 友元 | 所有成员列表
TSharedRef< ObjectType, Mode > 模板类 参考

TSharedRef is a non-nullable, non-intrusive reference-counted authoritative object reference. 更多...

#include <SharedPointer.h>

Public 成员函数

FORCEINLINE ObjectType & Get () const
 Returns a C++ reference to the object this shared reference is referencing 更多...
 
FORCEINLINE const int32 GetSharedReferenceCount () const
 Returns the number of shared references to this object (including this reference.) IMPORTANT: Not necessarily fast! Should only be used for debugging purposes! 更多...
 
FORCEINLINE const bool IsUnique () const
 Returns true if this is the only shared reference to this object. 更多...
 
FORCEINLINE ObjectType & operator* () const
 Dereference operator returns a reference to the object this shared pointer points to 更多...
 
FORCEINLINE ObjectType * operator-> () const
 Arrow operator returns a pointer to this shared reference's object 更多...
 
template<typename OtherType , typename = decltype(ImplicitConv<ObjectType*>((OtherType*)nullptr))>
FORCEINLINE TSharedRef & operator= (SharedPointerInternals::FRawPtrProxy< OtherType > const &InRawPtrProxy)
 Assignment operator replaces this shared reference with the specified shared reference. 更多...
 
FORCEINLINE TSharedRef & operator= (TSharedRef const &InSharedRef)
 Assignment operator replaces this shared reference with the specified shared reference. 更多...
 
 TSharedRef ()
 Constructs default shared reference that owns the default object for specified type. 更多...
 
template<typename OtherType , typename = decltype(ImplicitConv<ObjectType*>((OtherType*)nullptr))>
FORCEINLINE TSharedRef (OtherType *InObject)
 Constructs a shared reference that owns the specified object. 更多...
 
template<typename OtherType , typename DeleterType , typename = decltype(ImplicitConv<ObjectType*>((OtherType*)nullptr))>
FORCEINLINE TSharedRef (OtherType *InObject, DeleterType &&InDeleter)
 Constructs a shared reference that owns the specified object. 更多...
 
template<typename OtherType , typename = decltype(ImplicitConv<ObjectType*>((OtherType*)nullptr))>
FORCEINLINE TSharedRef (SharedPointerInternals::FRawPtrProxy< OtherType > const &InRawPtrProxy)
 Constructs a shared reference using a proxy reference to a raw pointer. 更多...
 
template<typename OtherType , typename = decltype(ImplicitConv<ObjectType*>((OtherType*)nullptr))>
FORCEINLINE TSharedRef (TSharedRef< OtherType, Mode > const &InSharedRef)
 Constructs a shared reference as a reference to an existing shared reference's object. 更多...
 
template<typename OtherType >
FORCEINLINE TSharedRef (TSharedRef< OtherType, Mode > const &InSharedRef, SharedPointerInternals::FConstCastTag)
 Special constructor used internally to cast a 'const' shared reference a 'mutable' reference. 更多...
 
template<typename OtherType >
FORCEINLINE TSharedRef (TSharedRef< OtherType, Mode > const &InSharedRef, SharedPointerInternals::FStaticCastTag)
 Special constructor used internally to statically cast one shared reference type to another. 更多...
 
template<typename OtherType >
FORCEINLINE TSharedRef (TSharedRef< OtherType, Mode > const &OtherSharedRef, ObjectType *InObject)
 Aliasing constructor used to create a shared reference which shares its reference count with another shared object, but pointing to a different object, typically a subobject. 更多...
 

友元

uint32 GetTypeHash (const TSharedRef< ObjectType, Mode > &InSharedRef)
 Computes a hash code for this object 更多...
 
template<class OtherType , ESPMode OtherMode>
class TSharedPtr
 
template<class OtherType , ESPMode OtherMode>
class TWeakPtr
 

详细描述

template<class ObjectType, ESPMode Mode>
class TSharedRef< ObjectType, Mode >

TSharedRef is a non-nullable, non-intrusive reference-counted authoritative object reference.

This shared reference will be conditionally thread-safe when the optional Mode template argument is set to ThreadSafe.

示例
/github/workspace/Engine/Source/Runtime/UMG/Public/Components/Widget.h.

构造及析构函数说明

◆ TSharedRef() [1/8]

template<class ObjectType , ESPMode Mode>
template<typename OtherType , typename = decltype(ImplicitConv<ObjectType*>((OtherType*)nullptr))>
FORCEINLINE TSharedRef< ObjectType, Mode >::TSharedRef ( OtherType *  InObject)
inlineexplicit

Constructs a shared reference that owns the specified object.

Must not be nullptr.

参数
InObjectObject this shared reference to retain a reference to

◆ TSharedRef() [2/8]

template<class ObjectType , ESPMode Mode>
template<typename OtherType , typename DeleterType , typename = decltype(ImplicitConv<ObjectType*>((OtherType*)nullptr))>
FORCEINLINE TSharedRef< ObjectType, Mode >::TSharedRef ( OtherType *  InObject,
DeleterType &&  InDeleter 
)
inline

Constructs a shared reference that owns the specified object.

Must not be nullptr.

参数
InObjectObject this shared pointer to retain a reference to
InDeleterDeleter object used to destroy the object when it is no longer referenced.

◆ TSharedRef() [3/8]

template<class ObjectType , ESPMode Mode>
TSharedRef< ObjectType, Mode >::TSharedRef ( )
inline

Constructs default shared reference that owns the default object for specified type.

Used internally only. Please do not use!

◆ TSharedRef() [4/8]

template<class ObjectType , ESPMode Mode>
template<typename OtherType , typename = decltype(ImplicitConv<ObjectType*>((OtherType*)nullptr))>
FORCEINLINE TSharedRef< ObjectType, Mode >::TSharedRef ( SharedPointerInternals::FRawPtrProxy< OtherType > const &  InRawPtrProxy)
inline

Constructs a shared reference using a proxy reference to a raw pointer.

(See MakeShareable()) Must not be nullptr.

参数
InRawPtrProxyProxy raw pointer that contains the object that the new shared reference will reference

◆ TSharedRef() [5/8]

template<class ObjectType , ESPMode Mode>
template<typename OtherType , typename = decltype(ImplicitConv<ObjectType*>((OtherType*)nullptr))>
FORCEINLINE TSharedRef< ObjectType, Mode >::TSharedRef ( TSharedRef< OtherType, Mode > const &  InSharedRef)
inline

Constructs a shared reference as a reference to an existing shared reference's object.

This constructor is needed so that we can implicitly upcast to base classes.

参数
InSharedRefThe shared reference whose object we should create an additional reference to

◆ TSharedRef() [6/8]

template<class ObjectType , ESPMode Mode>
template<typename OtherType >
FORCEINLINE TSharedRef< ObjectType, Mode >::TSharedRef ( TSharedRef< OtherType, Mode > const &  InSharedRef,
SharedPointerInternals::FStaticCastTag   
)
inline

Special constructor used internally to statically cast one shared reference type to another.

You should never call this constructor directly. Instead, use the StaticCastSharedRef() function. This constructor creates a shared reference as a shared reference to an existing shared reference after statically casting that reference's object. This constructor is needed for static casts.

参数
InSharedRefThe shared reference whose object we should create an additional reference to

◆ TSharedRef() [7/8]

template<class ObjectType , ESPMode Mode>
template<typename OtherType >
FORCEINLINE TSharedRef< ObjectType, Mode >::TSharedRef ( TSharedRef< OtherType, Mode > const &  InSharedRef,
SharedPointerInternals::FConstCastTag   
)
inline

Special constructor used internally to cast a 'const' shared reference a 'mutable' reference.

You should never call this constructor directly. Instead, use the ConstCastSharedRef() function. This constructor creates a shared reference as a shared reference to an existing shared reference after const casting that reference's object. This constructor is needed for const casts.

参数
InSharedRefThe shared reference whose object we should create an additional reference to

◆ TSharedRef() [8/8]

template<class ObjectType , ESPMode Mode>
template<typename OtherType >
FORCEINLINE TSharedRef< ObjectType, Mode >::TSharedRef ( TSharedRef< OtherType, Mode > const &  OtherSharedRef,
ObjectType *  InObject 
)
inline

Aliasing constructor used to create a shared reference which shares its reference count with another shared object, but pointing to a different object, typically a subobject.

参数
OtherSharedRefThe shared reference whose reference count should be shared.
InObjectThe object pointer to use (instead of the incoming shared pointer's object)

成员函数说明

◆ Get()

template<class ObjectType , ESPMode Mode>
FORCEINLINE ObjectType & TSharedRef< ObjectType, Mode >::Get ( ) const
inline

Returns a C++ reference to the object this shared reference is referencing

返回
The object owned by this shared reference

◆ GetSharedReferenceCount()

template<class ObjectType , ESPMode Mode>
FORCEINLINE const int32 TSharedRef< ObjectType, Mode >::GetSharedReferenceCount ( ) const
inline

Returns the number of shared references to this object (including this reference.) IMPORTANT: Not necessarily fast! Should only be used for debugging purposes!

返回
Number of shared references to the object (including this reference.)

◆ IsUnique()

template<class ObjectType , ESPMode Mode>
FORCEINLINE const bool TSharedRef< ObjectType, Mode >::IsUnique ( ) const
inline

Returns true if this is the only shared reference to this object.

Note that there may be outstanding weak references left. IMPORTANT: Not necessarily fast! Should only be used for debugging purposes!

返回
True if there is only one shared reference to the object, and this is it!

◆ operator*()

template<class ObjectType , ESPMode Mode>
FORCEINLINE ObjectType & TSharedRef< ObjectType, Mode >::operator* ( ) const
inline

Dereference operator returns a reference to the object this shared pointer points to

返回
Reference to the object

◆ operator->()

template<class ObjectType , ESPMode Mode>
FORCEINLINE ObjectType * TSharedRef< ObjectType, Mode >::operator-> ( ) const
inline

Arrow operator returns a pointer to this shared reference's object

返回
Returns a pointer to the object referenced by this shared reference

◆ operator=() [1/2]

template<class ObjectType , ESPMode Mode>
template<typename OtherType , typename = decltype(ImplicitConv<ObjectType*>((OtherType*)nullptr))>
FORCEINLINE TSharedRef & TSharedRef< ObjectType, Mode >::operator= ( SharedPointerInternals::FRawPtrProxy< OtherType > const &  InRawPtrProxy)
inline

Assignment operator replaces this shared reference with the specified shared reference.

The object currently referenced by this shared reference will no longer be referenced and will be deleted if there are no other referencers. Must not be nullptr.

参数
InRawPtrProxyProxy object used to assign the object (see MakeShareable helper function)

◆ operator=() [2/2]

template<class ObjectType , ESPMode Mode>
FORCEINLINE TSharedRef & TSharedRef< ObjectType, Mode >::operator= ( TSharedRef< ObjectType, Mode > const &  InSharedRef)
inline

Assignment operator replaces this shared reference with the specified shared reference.

The object currently referenced by this shared reference will no longer be referenced and will be deleted if there are no other referencers.

参数
InSharedRefShared reference to replace with

友元及相关函数文档

◆ GetTypeHash

template<class ObjectType , ESPMode Mode>
uint32 GetTypeHash ( const TSharedRef< ObjectType, Mode > &  InSharedRef)
friend

Computes a hash code for this object

参数
InSharedRefShared pointer to compute hash code for
返回
Hash code value

该类的文档由以下文件生成: