UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
VVMCellInline.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
9#include "VerseVM/VVMCell.h"
12#include "VerseVM/VVMHeap.h"
16
17namespace Verse
18{
19inline VEmergentType* VCell::GetEmergentType() const
20{
21 return FHeap::EmergentTypeOffsetToPtr(EmergentTypeOffset);
22}
23
24inline const VCppClassInfo* VCell::GetCppClassInfo() const
25{
26 return GetEmergentType()->CppClassInfo;
27}
28
29inline void VCell::AddRef(FAccessContext Context)
30{
31 GlobalStrongCellRegistry.Get()->Add(Context, this);
32}
33
34inline void VCell::ReleaseRef()
35{
36 GlobalStrongCellRegistry.Get()->Remove(this);
37}
38
39template <typename CastType>
40bool VCell::IsA() const
41{
42 static_assert(std::is_base_of_v<VCell, CastType>);
43 return GetCppClassInfo()->IsA(&CastType::StaticCppClassInfo);
44}
45
46template <typename CastType>
47const CastType& VCell::StaticCast() const
48{
50 TEXT("Expected object of type %s, but got object of type %s."),
51 *CastType::StaticCppClassInfo.DebugName(),
52 *DebugName());
53 return *static_cast<const CastType*>(this);
54}
55
56template <typename CastType>
57CastType& VCell::StaticCast()
58{
60 TEXT("Expected object of type %s, but got object of type %s."),
61 *CastType::StaticCppClassInfo.DebugName(),
62 *DebugName());
63 return *static_cast<CastType*>(this);
64}
65
66template <typename CastType>
67CastType* VCell::DynamicCast()
68{
69 return IsA<CastType>() ? static_cast<CastType*>(this) : nullptr;
70}
71
72template <typename CastType>
73CastType* VCell::DynamicCast() const
74{
75 return IsA<CastType>() ? static_cast<CastType*>(this) : nullptr;
76}
77
79{
80 return Cell.GetEmergentType()->CppClassInfo->GetTypeHash(&Cell);
81}
82
83template <typename TVisitor>
84void VCell::VisitReferencesImpl(TVisitor& Visitor)
85{
86 Visitor.Visit(GetEmergentType(), TEXT("EmergentType"));
87 if ((GCData.load(std::memory_order_relaxed) & GCDataIsWeakKeyBit))
88 {
89 FWeakKeyMapGuard Guard(FHeapPageHeader::Get(this));
90 if (FWeakKeyMap* Map = Guard.TryGet())
91 {
92 Map->Visit(this, Visitor);
93 }
94 else
95 {
97 }
98 }
99}
100
102} // namespace Verse
103#endif // WITH_VERSE_VM
#define checkf(expr, format,...)
Definition AssertionMacros.h:315
#define TEXT(x)
Definition Platform.h:1272
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
uint32_t uint32
Definition binka_ue_file_header.h:6
@ Visitor
Definition XmppMultiUserChat.h:94
Definition Archive.h:36
uint32 GetTypeHash(TPtrVariant< Ts... > Ptr)
Definition VVMPtrVariant.h:83