UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
NetHandle.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
8#include "UObject/ObjectKey.h"
9
10namespace UE::Net
11{
12 class FNetHandle;
13 class FNetHandleManager;
14 namespace Private
15 {
17 }
18}
19
23
24namespace UE::Net
25{
26
32{
33public:
34 FNetHandle();
37
40
41 uint32 GetId() const;
42 bool IsValid() const;
43
44 bool IsCompleteHandle() const;
45
46 bool operator==(FNetHandle Other) const;
47 bool operator<(FNetHandle Other) const;
48 bool operator!=(FNetHandle Other) const;
49
50 NETCORE_API FString ToString() const;
51
52private:
53 friend FNetHandleManager;
54 friend Private::FNetPushObjectHandle;
55
57
58 struct FInternalValue
59 {
60 uint32 Id;
61 uint32 Epoch;
62 };
63
64 FNetHandle(FObjectKey ObjectKey);
65 explicit FNetHandle(FInternalValue InInternalValue);
67
68 uint64 GetInternalValue() const;
69
70 union
71 {
72#if UE_WITH_REMOTE_OBJECT_HANDLE
74#else
76#endif
77 FInternalValue InternalValue;
78 };
79};
80
82: Value()
83{
84}
85
90
95
96inline FNetHandle::FNetHandle(FObjectKey ObjectKey)
97#if UE_WITH_REMOTE_OBJECT_HANDLE
98: Value(ObjectKey.GetRemoteId())
99#else
100: Value(ObjectKey)
101#endif
102{
103}
104
105inline FNetHandle::FNetHandle(FInternalValue InInternalValue)
106#if UE_WITH_REMOTE_OBJECT_HANDLE
108#else
110#endif
111{
112}
113
115#if UE_WITH_REMOTE_OBJECT_HANDLE
117#else
119#endif
120{
121}
122
123inline uint64 FNetHandle::GetInternalValue() const
124{
125 return BitCast<uint64>(Value);
126}
127
129{
130 Value = Other.Value;
131 return *this;
132}
133
135{
136 Value = Other.Value;
137 return *this;
138}
139
141{
143}
144
145inline bool FNetHandle::IsValid() const
146{
147#if UE_WITH_REMOTE_OBJECT_HANDLE
148 return Value != FRemoteObjectId();
149#else
150 return Value != FObjectKey();
151#endif
152}
153
155{
156#if UE_WITH_REMOTE_OBJECT_HANDLE
157 return Value != FRemoteObjectId();
158#else
159 return Value != FObjectKey();
160#endif
161}
162
164{
165 return GetId() == Other.GetId();
166}
167
169{
170 return GetId() < Other.GetId();
171}
172
174{
175 return GetId() != Other.GetId();
176}
177
179{
180 return GetTypeHash(Handle.Value);
181}
182
183}
184
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
NETCORE_API FAnsiStringBuilderBase & operator<<(FAnsiStringBuilderBase &Builder, const UE::Net::FNetHandle &NetHandle)
Definition NetHandle.cpp:19
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition StringBuilder.h:79
Definition NetHandleManager.h:27
Definition NetHandle.h:32
FInternalValue InternalValue
Definition NetHandle.h:77
FObjectKey Value
Definition NetHandle.h:75
friend uint32 GetTypeHash(FNetHandle Handle)
Definition NetHandle.h:178
bool operator==(FNetHandle Other) const
Definition NetHandle.h:163
FNetHandle & operator=(const FNetHandle &Other)
Definition NetHandle.h:128
bool IsCompleteHandle() const
Definition NetHandle.h:154
bool IsValid() const
Definition NetHandle.h:145
FNetHandle()
Definition NetHandle.h:81
bool operator!=(FNetHandle Other) const
Definition NetHandle.h:173
uint32 GetId() const
Definition NetHandle.h:140
bool operator<(FNetHandle Other) const
Definition NetHandle.h:168
NETCORE_API FString ToString() const
Definition NetHandle.cpp:10
Definition OverriddenPropertySet.cpp:45
Definition NetworkVersion.cpp:28
uint32 GetTypeHash(const FNetIDVariant &NetID)
Definition NetIDVariant.h:55
Definition ObjectKey.h:19
Definition RemoteObjectTypes.h:212