UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
VVMRefInline.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#if WITH_VERSE_VM || defined(__INTELLISENSE__)
6
8
9#include "VerseVM/VVMRef.h"
11#include "VerseVM/VVMTask.h"
13
14namespace Verse
15{
16inline void VRestValue::SetTransactionally(FAllocationContext Context, VValue NewValue)
17{
18 checkSlow(!NewValue.IsRoot());
19 Value.SetTransactionally(Context, NewValue);
20}
21
22inline void VRestValue::SetTrailed(FAllocationContext Context, VValue NewValue)
23{
24 checkSlow(!NewValue.IsRoot());
25 Value.SetTrailed(Context, NewValue);
26}
27
28template <typename FunctionType>
29bool FRefAwaiterHeader::AnyOf(const TSet<FRefAwaiter>& Set, FunctionType F) const
30{
32 ElementIds.Reserve(Set.Num());
33 for (FSetElementId I = Next; I.IsValidId(); I = Set.Get(I).Next)
34 {
35 ElementIds.Add(I);
36 }
37 for (FSetElementId ElementId : ElementIds)
38 {
39 if (F(Set[ElementId]))
40 {
41 return true;
42 }
43 }
44 return false;
45}
46
47inline bool operator==(const FRefAwaiter& Left, const FRefAwaiter& Right)
48{
49 return Left.Task == Right.Task && Left.AwaitPC == Right.AwaitPC;
50}
51
52inline uint32 GetTypeHash(const FRefAwaiter& Arg)
53{
54 uint32 Result = 0;
55 Result = HashCombineFast(Result, GetTypeHash(Arg.Task));
56 Result = HashCombineFast(Result, PointerHash(Arg.AwaitPC));
57 return Result;
58}
59
60template <typename UnaryFunction>
61inline bool VRefRareData::AnyAwaitTask(UnaryFunction F) const
62{
63 AutoRTFM::UnreachableIfClosed("#jira SOL-8415");
64 return AwaiterHeader.AnyOf(AwaiterBuffer, [&](const FRefAwaiter& Awaiter) {
65 AutoRTFM::UnreachableIfClosed("#jira SOL-8415");
66 if (!ContainsAwaitTask(*Awaiter.Task, *Awaiter.AwaitPC))
67 {
68 return false;
69 }
70 return F(*Awaiter.Task);
71 });
72}
73
74inline void VRef::Set(FAllocationContext Context, VValue NewValue)
75{
76 return Value.SetTransactionally(Context, NewValue);
77}
78} // namespace Verse
79#endif // WITH_VERSE_VM
#define checkSlow(expr)
Definition AssertionMacros.h:332
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
uint32 PointerHash(const void *Key)
Definition TypeHash.h:91
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition SetUtilities.h:95
UE_FORCEINLINE_HINT bool IsValidId() const
Definition SetUtilities.h:101
Definition Array.h:670
UE_FORCEINLINE_HINT void Reserve(SizeType Number)
Definition Array.h:3016
UE_STRING_CLASS Result(Forward< LhsType >(Lhs), RhsLen)
Definition String.cpp.inl:732
Definition Archive.h:36
uint32 GetTypeHash(TPtrVariant< Ts... > Ptr)
Definition VVMPtrVariant.h:83
bool operator==(VFloat Left, VFloat Right)
Definition VVMFloat.cpp:81