UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ReferenceToken.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
6#include "CoreTypes.h"
8
9class FGCObject;
10class FGCObjectInfo;
12class UObject;
13
14namespace Verse
15{
16 struct VCell;
17}
18
19namespace UE
20{
21 namespace GC
22 {
23 class FMemberId;
24 }
25}
26
29{
30 // The following types have associated pointers and must have values in the range of [0, 7)
31 None,
32 Object,
37
38 // The following types must have the three lower bits clear
39 Barrier = 1 << 3,
40};
41
44{
46 : EncodedBits(0)
47 {
48 }
49
52 {
53 }
54
59
60 explicit FReferenceToken(const Verse::VCell* Cell)
62 {
63 }
64
69
74
76 : EncodedBits(static_cast<uint64>(TokenType))
77 {
78 checkf((EncodedBits & EncodingBits) == 0, TEXT("Reference token type constructor can only be used with the pointer-less types"));
79 }
80
82 {
83 // None is treated as a special value. When found, then all bits are converted to the enum.
84 EReferenceTokenType Type = static_cast<EReferenceTokenType>(EncodedBits & EncodingBits);
85 return Type == EReferenceTokenType::None ? static_cast<EReferenceTokenType>(EncodedBits) : Type;
86 }
87
88 bool IsObject() const
89 {
91 }
92
94 {
96 return BitCast<UObject*>(EncodedBits & ~EncodingBits);
97 }
98
99 bool IsGCObject() const
100 {
102 }
103
105 {
107 return BitCast<FGCObject*>(EncodedBits & ~EncodingBits);
108 }
109
110 bool IsGCObjectInfo() const
111 {
113 }
114
116 {
118 return BitCast<FGCObjectInfo*>(EncodedBits & ~EncodingBits);
119 }
120
121 bool IsVerseCell() const
122 {
124 }
125
126 Verse::VCell* AsVerseCell() const
127 {
129 return BitCast<Verse::VCell*>(EncodedBits & ~EncodingBits);
130 }
131
132 bool IsGCVerseCellInfo() const
133 {
135 }
136
138 {
140 return BitCast<FGCVerseCellInfo*>(EncodedBits & ~EncodingBits);
141 }
142
144 FString GetDescription() const;
146
148 FString GetMemberName(UE::GC::FMemberId& MemberId) const;
149
151 {
152 return EncodedBits == Other.EncodedBits;
153 }
154
156 {
157 return GetTypeHash(Info.EncodedBits);
158 }
159
160private:
161 static constexpr uint64 EncodingBits = 0b111;
162 uint64 EncodedBits{ 0 };
163};
#define checkSlow(expr)
Definition AssertionMacros.h:332
#define checkf(expr, format,...)
Definition AssertionMacros.h:315
#define TEXT(x)
Definition Platform.h:1272
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition Platform.h:1117
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
EReferenceTokenType
Definition ReferenceToken.h:29
ToType BitCast(const FromType &From)
Definition TypeCompatibleBytes.h:167
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition GCObjectInfo.h:28
Definition GCObject.h:128
Definition NameTypes.h:617
Definition GarbageCollectionSchema.h:157
Definition Object.h:95
Definition AdvancedWidgetsModule.cpp:13
Definition Archive.h:36
Definition ReferenceToken.h:44
FGCObjectInfo * AsGCObjectInfo() const
Definition ReferenceToken.h:115
EReferenceTokenType GetType() const
Definition ReferenceToken.h:81
UObject * AsObject() const
Definition ReferenceToken.h:93
FGCVerseCellInfo * AsGCVerseCellInfo() const
Definition ReferenceToken.h:137
bool IsGCVerseCellInfo() const
Definition ReferenceToken.h:132
FReferenceToken(EReferenceTokenType TokenType)
Definition ReferenceToken.h:75
bool IsGCObject() const
Definition ReferenceToken.h:99
Verse::VCell * AsVerseCell() const
Definition ReferenceToken.h:126
bool IsGCObjectInfo() const
Definition ReferenceToken.h:110
FGCObject * AsGCObject() const
Definition ReferenceToken.h:104
FReferenceToken()
Definition ReferenceToken.h:45
FReferenceToken(const FGCVerseCellInfo *GCVerseCellInfo)
Definition ReferenceToken.h:70
bool IsObject() const
Definition ReferenceToken.h:88
FString GetMemberName(UE::GC::FMemberId &MemberId) const
Definition ReferenceToken.cpp:60
friend uint32 GetTypeHash(const FReferenceToken &Info)
Definition ReferenceToken.h:155
FReferenceToken(const FGCObjectInfo *GCObjectInfo)
Definition ReferenceToken.h:65
FReferenceToken(const UObject *Object)
Definition ReferenceToken.h:50
FString GetDescription() const
Definition ReferenceToken.cpp:18
FReferenceToken(const Verse::VCell *Cell)
Definition ReferenceToken.h:60
FReferenceToken(const FGCObject *GCObject)
Definition ReferenceToken.h:55
bool operator==(const FReferenceToken &Other) const
Definition ReferenceToken.h:150
bool IsVerseCell() const
Definition ReferenceToken.h:121