UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TGCObjectScopeGuard< ObjectType > Class Template Reference

#include <GCObjectScopeGuard.h>

+ Inheritance diagram for TGCObjectScopeGuard< ObjectType >:

Public Member Functions

 TGCObjectScopeGuard (ObjectType *InObject)
 
virtual ~TGCObjectScopeGuard ()
 
 TGCObjectScopeGuard (const TGCObjectScopeGuard &)=delete
 
TGCObjectScopeGuardoperator= (const TGCObjectScopeGuard &)=delete
 
virtual void AddReferencedObjects (FReferenceCollector &Collector) override
 
virtual FString GetReferencerName () const override
 
UE_FORCEINLINE_HINT ObjectType * Get () const
 
- Public Member Functions inherited from FGCObject
 FGCObject ()
 
 FGCObject (const FGCObject &Other)
 
 FGCObject (FGCObject &&Other)
 
 FGCObject (EFlags Flags)
 
virtual ~FGCObject ()
 
FGCObjectoperator= (const FGCObject &)
 
FGCObjectoperator= (FGCObject &&)
 
COREUOBJECT_API void RegisterGCObject ()
 
COREUOBJECT_API void UnregisterGCObject ()
 
virtual bool GetReferencerPropertyName (UObject *Object, FString &OutPropertyName) const
 

Additional Inherited Members

- Public Types inherited from FGCObject
enum class  EFlags : uint32 { None = 0 , RegisterLater = 1 << 0 , AddStableNativeReferencesOnly = 1 << 1 }
 
- Static Public Member Functions inherited from FGCObject
static COREUOBJECT_API void StaticInit ()
 
- Static Public Attributes inherited from FGCObject
static COREUOBJECT_API UGCObjectReferencerGGCObjectReferencer = nullptr
 

Detailed Description

template<typename ObjectType>
class TGCObjectScopeGuard< ObjectType >

Specific implementation of FGCObject that prevents a single UObject-based pointer from being GC'd while this guard is in scope.

Note
This is the lean version of TStrongObjectPtr which uses an inline FGCObject so can't safely be used with containers that treat types as trivially relocatable.

Constructor & Destructor Documentation

◆ TGCObjectScopeGuard() [1/2]

template<typename ObjectType >
TGCObjectScopeGuard< ObjectType >::TGCObjectScopeGuard ( ObjectType *  InObject)
inlineexplicit

◆ ~TGCObjectScopeGuard()

template<typename ObjectType >
virtual TGCObjectScopeGuard< ObjectType >::~TGCObjectScopeGuard ( )
inlinevirtual

◆ TGCObjectScopeGuard() [2/2]

template<typename ObjectType >
TGCObjectScopeGuard< ObjectType >::TGCObjectScopeGuard ( const TGCObjectScopeGuard< ObjectType > &  )
delete

Non-copyable

Member Function Documentation

◆ AddReferencedObjects()

template<typename ObjectType >
virtual void TGCObjectScopeGuard< ObjectType >::AddReferencedObjects ( FReferenceCollector Collector)
inlineoverridevirtual

Pure virtual that must be overloaded by the inheriting class. Use this method to serialize any UObjects contained that you wish to keep around.

Parameters
CollectorThe collector of referenced objects.

Implements FGCObject.

◆ Get()

template<typename ObjectType >
UE_FORCEINLINE_HINT ObjectType * TGCObjectScopeGuard< ObjectType >::Get ( ) const
inline

◆ GetReferencerName()

template<typename ObjectType >
virtual FString TGCObjectScopeGuard< ObjectType >::GetReferencerName ( ) const
inlineoverridevirtual

Overload this method to report a name for your referencer

Implements FGCObject.

◆ operator=()

template<typename ObjectType >
TGCObjectScopeGuard & TGCObjectScopeGuard< ObjectType >::operator= ( const TGCObjectScopeGuard< ObjectType > &  )
delete

The documentation for this class was generated from the following file: