UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
PropertyReplicationState.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "HAL/Platform.h"
7
8namespace UE::Net
9{
10 struct FReplicationStateDescriptor;
11}
12
13namespace UE::Net
14{
15
25{
26public:
29
32
34
37
44
47
51 IRISCORE_API bool IsValid() const;
52
53 //
54 // Note: There is little to none error checking in the methods below, they are mostly intended to be used from internal code and tests
55 // Expected usage for this type of ReplicationState is through the polling system
56 //
57
65
72
74 IRISCORE_API bool IsDirty(uint32 Index) const;
75
78
88 IRISCORE_API bool PollPropertyReplicationState(const void* RESTRICT SrcData);
89
95
106
111
113 IRISCORE_API void PushPropertyReplicationState(const UObject* Owner, void* RESTRICT DstData, bool bPushAll = false) const;
114
115
121 IRISCORE_API bool PollObjectReferences(const void* RESTRICT SrcData);
122
127
129 {
130 // Previous state if requested
132
133 // This is an init state
134 bool bIsInit = false;
135
136 // Only call repnotify if value differs from local value
138 };
139
142 inline void CallRepNotifies(void* RESTRICT DstData, const FPropertyReplicationState* PreviousState, bool bIsInit) const;
143
145 IRISCORE_API FString ToString(bool bIncludeAll = true) const;
146
148 IRISCORE_API const TCHAR* ToString(FStringBuilderBase& StringBuilder, bool bIncludeAll = true) const;
149
150 const FReplicationStateDescriptor* GetReplicationStateDescriptor() const { return ReplicationStateDescriptor; }
151 uint8* GetStateBuffer() const { return StateBuffer; }
152
153protected:
156
157public:
158 // These methods are for internal use only.
159
160 enum : unsigned
161 {
162 // How many bits to use to track dirtiness for individual elements.
164 // The changemask bit into the TArray changemask info that indicates the TArray is dirty.
166 // At which offset in the TArray changemask element dirtiness begins.
168 };
169
175
179 IRISCORE_API bool IsDirtyForPolling() const;
180
181private:
182 // Returns true if member should be polled, returns true if memberpollmask is dirty or if changemask is dirty.
183 bool IsDirtyForPolling(uint32 Index) const;
184
185 // Returns true if changemask or header of the state is marked dirty
186 bool IsDirty() const;
187 bool IsInitState() const;
188 void ConstructStateInternal();
189 void DestructStateInternal();
190 void InjectState(const FReplicationStateDescriptor* Descriptor, uint8* InStateBuffer);
191 void PollPropertyValue(uint32 Index, const void* SrcValue);
192 void PushPropertyValue(uint32 Index, void* DstValue) const;
193
194 TRefCountPtr<const FReplicationStateDescriptor> ReplicationStateDescriptor;
195 uint8* StateBuffer;
196 uint32 bOwnState : 1;
197};
198
200{
202
203 Params.PreviousState = PreviousState;
204 Params.bIsInit = bIsInit;
205 CallRepNotifies(DstData, Params);
206}
207
208}
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
#define RESTRICT
Definition Platform.h:706
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition RefCounting.h:454
Definition PropertyReplicationState.h:25
IRISCORE_API bool PollObjectReferences(const void *RESTRICT SrcData)
Definition PropertyReplicationState.cpp:453
IRISCORE_API bool IsDirty(uint32 Index) const
Definition PropertyReplicationState.cpp:234
uint8 * GetStateBuffer() const
Definition PropertyReplicationState.h:151
IRISCORE_API void CopyDirtyProperties(const FPropertyReplicationState &Other)
Definition PropertyReplicationState.cpp:438
IRISCORE_API FString ToString(bool bIncludeAll=true) const
Definition PropertyReplicationState.cpp:591
IRISCORE_API bool IsCustomConditionEnabled(uint32 Index) const
Definition PropertyReplicationState.cpp:599
IRISCORE_API void PushPropertyReplicationState(const UObject *Owner, void *RESTRICT DstData, bool bPushAll=false) const
Definition PropertyReplicationState.cpp:381
IRISCORE_API void MarkDirty(uint32 Index)
Definition PropertyReplicationState.cpp:205
IRISCORE_API bool PollPushBasedPropertyReplicationState(const void *RESTRICT SrcData, const FPollParameters &PollParameters)
Definition PropertyReplicationState.cpp:307
IRISCORE_API void GetPropertyValue(uint32 Index, void *DstValue) const
Definition PropertyReplicationState.cpp:199
IRISCORE_API void SetPropertyValue(uint32 Index, const void *SrcValue)
Definition PropertyReplicationState.cpp:187
IRISCORE_API FPropertyReplicationState & operator=(const FPropertyReplicationState &Other)
Definition PropertyReplicationState.cpp:56
const FReplicationStateDescriptor * GetReplicationStateDescriptor() const
Definition PropertyReplicationState.h:150
IRISCORE_API bool PollPropertyReplicationState(const void *RESTRICT SrcData)
Definition PropertyReplicationState.cpp:277
IRISCORE_API ~FPropertyReplicationState()
Definition PropertyReplicationState.cpp:73
IRISCORE_API void MarkArrayDirty(uint32 Index)
Definition PropertyReplicationState.cpp:251
IRISCORE_API bool IsDirtyForPolling() const
Definition PropertyReplicationState.cpp:88
IRISCORE_API bool StoreCurrentPropertyReplicationStateForRepNotifies(const void *RESTRICT SrcData, const FPropertyReplicationState *NewStateToBeApplied)
Definition PropertyReplicationState.cpp:345
@ TArrayElementChangeMaskBits
Definition PropertyReplicationState.h:163
@ TArrayPropertyChangeMaskBitIndex
Definition PropertyReplicationState.h:165
@ TArrayElementChangeMaskBitOffset
Definition PropertyReplicationState.h:167
IRISCORE_API void CallRepNotifies(void *RESTRICT DstData, const FCallRepNotifiesParameters &Params) const
Definition PropertyReplicationState.cpp:482
IRISCORE_API bool IsValid() const
Definition PropertyReplicationState.cpp:78
Definition Object.h:95
Definition NetworkVersion.cpp:28
U16 Index
Definition radfft.cpp:71
bool bIsInit
Definition PropertyReplicationState.h:134
bool bOnlyCallIfDiffersFromLocal
Definition PropertyReplicationState.h:137
const FPropertyReplicationState * PreviousState
Definition PropertyReplicationState.h:131
Definition PropertyReplicationState.h:91
bool bEnableVerboseProfiling
Definition PropertyReplicationState.h:92
bool bForceRefreshObjectReferences
Definition PropertyReplicationState.h:93
Definition ReplicationStateDescriptor.h:199