UDocumentation
UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
VVMBytecodeDispatcher.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
7
#include "
Templates/UnrealTemplate.h
"
8
#include "
VVMBytecode.h
"
9
#include "
VVMBytecodeOps.h
"
10
#include "
VVMBytecodesAndCaptures.h
"
11
#include "
VVMLog.h
"
12
#include "
VVMProcedure.h
"
13
14
namespace
Verse
15
{
16
template
<
typename
HandlerType>
17
decltype
(
auto
)
DispatchOp
(FOp& Op,
HandlerType
&& Handler)
18
{
19
switch
(Op.Opcode)
20
{
21
#define VISIT_OP(Name) \
22
case EOpcode::Name: \
23
return Handler(static_cast<FOp##Name&>(Op));
24
25
VERSE_ENUM_OPS
(
VISIT_OP
)
26
27
#undef VISIT_OP
28
}
29
V_DIE
(
"Invalid opcode: %u"
,
static_cast<
FOpcodeInt
>
(Op.Opcode));
30
}
31
32
template
<
typename
HandlerType>
33
void
DispatchOps
(FOp*
OpsBegin
, FOp*
OpsEnd
,
HandlerType
&& Handler)
34
{
35
FOp* Op =
OpsBegin
;
36
while
(Op <
OpsEnd
)
37
{
38
Op =
DispatchOp
(*Op, [&](
auto
&& Op) -> FOp* {
39
Handler(Op);
40
return
&Op + 1;
41
});
42
}
43
}
44
45
// HandlerType can take in an FOp& or an auto& and descriminate on the actual
46
// subtype of FOp being passed in.
47
template
<
typename
HandlerType>
48
void
DispatchOps
(
VProcedure
&
Procedure
,
HandlerType
&& Handler)
49
{
50
DispatchOps
(
Procedure
.GetOpsBegin(),
Procedure
.GetOpsEnd(),
Forward<HandlerType>
(Handler));
51
}
52
53
}
// namespace Verse
54
#endif
// WITH_VERSE_VM
StaticCastSharedRef
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition
SharedPointer.h:127
UnrealTemplate.h
VVMBytecodeOps.h
VVMBytecode.h
VVMBytecodesAndCaptures.h
VVMLog.h
VVMProcedure.h
Verse
Definition
Archive.h:36
Engine
Source
Runtime
CoreUObject
Public
VerseVM
VVMBytecodeDispatcher.h
Generated by
1.9.8