UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
VVMShapeInline.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2#pragma once
3
4#if WITH_VERSE_VM || defined(__INTELLISENSE__)
5
10#include "VerseVM/VVMShape.h"
14
15namespace Verse
16{
17inline VShape::VEntry::VEntry(const VShape::VEntry& Other)
18 : Type(Other.Type)
19{
20 switch (Type)
21 {
22 case EFieldType::Offset:
23 Index = Other.Index;
24 break;
25 case EFieldType::FProperty:
26 case EFieldType::FPropertyVar:
27 case EFieldType::FVerseProperty:
29 break;
30 case EFieldType::Constant:
31 new (&Value) TWriteBarrier<VValue>(Other.Value);
32 break;
33 }
34}
35
36inline bool VShape::VEntry::IsAccessor() const
37{
38 return Type == EFieldType::Constant && Value.Get().IsCellOfType<VAccessor>();
39}
40
41inline VShape::VEntry::VEntry()
42 : Index(0)
44
45inline VShape::VEntry::VEntry(FProperty* InProperty, EFieldType InType)
47 , Type(InType) {}
48
49inline VShape::VEntry::VEntry(FAccessContext Context, VValue InConstant)
52
53inline bool VShape::VEntry::operator==(const VShape::VEntry& Other) const
54{
55 if (Type != Other.Type)
56 {
57 return false;
58 }
59 switch (Type)
60 {
61 case EFieldType::Offset:
62 return Index == Other.Index;
63 case EFieldType::FProperty:
64 case EFieldType::FPropertyVar:
65 case EFieldType::FVerseProperty:
66 return UProperty == Other.UProperty;
67 case EFieldType::Constant:
68 {
69 ECompares Cmp = VValue::Equal(FAllocationContext(FRunningContextPromise()), Value.Get(), Other.Value.Get(),
70 [](VValue Left, VValue Right) {
71 checkSlow(!Left.IsPlaceholder());
72 checkSlow(!Right.IsPlaceholder());
73 });
74 return Cmp == ECompares::Eq;
75 }
76 }
77}
78
79inline bool VShape::FFieldsMapKeyFuncs::Matches(KeyInitType A, KeyInitType B)
80{
81 return A == B;
82}
83
84inline bool VShape::FFieldsMapKeyFuncs::Matches(KeyInitType A, const VUniqueString& B)
85{
86 return *(A.Get()) == B;
87}
88
89inline uint32 VShape::FFieldsMapKeyFuncs::GetKeyHash(KeyInitType Key)
90{
91 return GetTypeHash(Key);
92}
93
94inline uint32 VShape::FFieldsMapKeyFuncs::GetKeyHash(const VUniqueString& Key)
95{
96 return GetTypeHash(Key);
97}
98
99inline const VShape::VEntry* VShape::GetField(const VUniqueString& Name) const
100{
101 return Fields.FindByHash(GetTypeHash(Name), Name);
102}
103
104inline const VShape::VEntry& VShape::GetField(int32 FieldIndex) const
105{
106 return Fields.Get(FSetElementId::FromInteger(FieldIndex)).Value;
107}
108
109inline uint64 VShape::GetNumFields() const
110{
111 return Fields.Num();
112}
113
114inline bool VShape::operator==(const VShape& Other) const
115{
116 return Fields.OrderIndependentCompareEqual(Other.Fields);
117}
118
119inline uint32 GetTypeHash(const VShape::VEntry& Field)
120{
121 switch (Field.Type)
122 {
123 case Verse::EFieldType::Offset:
124 return HashCombineFast(::GetTypeHash(static_cast<int8>(Field.Type)), ::GetTypeHash(Field.Index));
125 case Verse::EFieldType::Constant:
126 return HashCombineFast(::GetTypeHash(static_cast<int8>(Field.Type)), GetTypeHash(Field.Value.Get()));
127 case Verse::EFieldType::FProperty:
128 case Verse::EFieldType::FPropertyVar:
129 case Verse::EFieldType::FVerseProperty:
130 default:
132 }
133}
134
135inline uint32 GetTypeHash(const VShape& Shape)
136{
137 uint32 Hash = 0;
138 for (const auto& It : Shape.Fields)
139 {
141 Hash = HashCombineFast(Hash, GetTypeHash(It.Value));
142 }
143 return Hash;
144}
145
146} // namespace Verse
147#endif // WITH_VERSE_VM
FPlatformTypes::int8 int8
An 8-bit signed integer.
Definition Platform.h:1121
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
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
constexpr uint32 HashCombineFast(uint32 A, uint32 B)
Definition TypeHash.h:74
#define VERSE_UNREACHABLE()
Definition VVMUnreachable.h:8
uint32 Offset
Definition VulkanMemory.cpp:4033
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition UnrealType.h:174
static UE_FORCEINLINE_HINT FSetElementId FromInteger(int32 Integer)
Definition SetUtilities.h:121
Definition UnrealTypePrivate.h:18
COREUOBJECT_API UProperty(const FObjectInitializer &ObjectInitializer=FObjectInitializer::Get())
Definition PropertyPrivate.cpp:33
Type
Definition PawnAction_Move.h:11
uint32 GetTypeHash(const FKey &Key)
Definition BlackboardKey.h:35
Definition FieldSystemNoiseAlgo.cpp:6
EFieldType
Definition Protocol0.h:52
Definition Archive.h:36
U16 Index
Definition radfft.cpp:71