UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ObjectScopeHysteresisUpdater.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreTypes.h"
6#include "Containers/Array.h"
7#include "Containers/Map.h"
9
10namespace UE::Net::Private
11{
13}
14
15namespace UE::Net::Private
16{
17
19{
20public:
21 void Init(uint32 MaxObjectCount);
22 void Deinit();
23
26
28 void SetHysteresisFrameCount(FInternalNetRefIndex NetRefIndex, uint16 HysteresisFrameCount);
29
31 void RemoveHysteresis(FInternalNetRefIndex NetRefIndex);
32
35
38
41
43 bool HasObjectsToUpdate() const;
44
47
49 bool IsObjectUpdated(FInternalNetRefIndex NetRefIndex) const;
50
51private:
52 enum : unsigned
53 {
54 LocalIndexGrowCount = 256U,
55 };
56
57 typedef uint32 FLocalIndex;
58
59 FLocalIndex GetOrCreateLocalIndex(FInternalNetRefIndex NetRefIndex);
60 void FreeLocalIndex(FLocalIndex LocalIndex);
61
62 // Per LocalIndex how many frames left to update before filtering out the object.
63 TArray<uint16> FrameCounters;
64 // Lookup table for local index to InternalNetRefIndex.
65 TArray<FInternalNetRefIndex> LocalIndexToNetRefIndex;
66 // Lookup map for InternalNetRefIndex to LocalIndex to be able to figure out whether an object already is assigned a LocalIndex or not.
67 TMap<FInternalNetRefIndex, FLocalIndex> NetRefIndexToLocalIndex;
68 // A set bit indicates that the LocalIndex is used. Only stores MaxLocalIndex bits. The bitarray grows as needed.
69 FNetBitArray UsedLocalIndices;
70 // A set bit indicates that the InternalNetRefIndex is being updated. Can always hold the MaxObjectCount passed to Init().
71 FNetBitArray ObjectsToUpdate;
72};
73
75{
76 return !NetRefIndexToLocalIndex.IsEmpty();
77}
78
83
85{
86 return ObjectsToUpdate.GetBit(ObjectIndex);
87}
88
89}
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
void Init()
Definition LockFreeList.h:4
uint8_t uint8
Definition binka_ue_file_header.h:8
uint16_t uint16
Definition binka_ue_file_header.h:7
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition ArrayView.h:139
Definition Array.h:670
Definition UnrealString.h.inl:34
Definition NetBitArray.h:337
Definition NetBitArray.h:74
bool GetBit(uint32 Index) const
Definition NetBitArray.h:1253
Definition ObjectScopeHysteresisUpdater.h:19
void SetHysteresisFrameCount(FInternalNetRefIndex NetRefIndex, uint16 HysteresisFrameCount)
Definition ObjectScopeHysteresisUpdater.cpp:29
void RemoveHysteresis(FInternalNetRefIndex NetRefIndex)
Definition ObjectScopeHysteresisUpdater.cpp:35
bool HasObjectsToUpdate() const
Definition ObjectScopeHysteresisUpdater.h:74
void Deinit()
Definition ObjectScopeHysteresisUpdater.cpp:15
void OnMaxInternalNetRefIndexIncreased(FInternalNetRefIndex NewMaxInternalIndex)
Definition ObjectScopeHysteresisUpdater.cpp:24
bool IsObjectUpdated(FInternalNetRefIndex NetRefIndex) const
Definition ObjectScopeHysteresisUpdater.h:84
FNetBitArrayView GetUpdatedObjects() const
Definition ObjectScopeHysteresisUpdater.h:79
Definition NetworkVersion.cpp:28
uint32 FInternalNetRefIndex
Definition ReplicationStateStorage.h:20
FNetBitArrayView MakeNetBitArrayView(const FNetBitArrayView::StorageWordType *Storage, uint32 BitCount)
Definition NetBitArray.h:1677