UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
StateStreamHandle.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "StateStreamHandle.generated.h"
6
7#define UE_API STATESTREAM_API
8
11
13// Base type for state stream handles. This code is not supposed to be used directly.
14// To create your new state stream you will need a handle dedicated to that state stream. Example:
15//
16// USTRUCT(StateStreamHandle)
17// struct FFooHandle : public FStateStreamHandle
18// {
19// GENERATED_USTRUCT_BODY()
20// };
21//
22
23USTRUCT(NoExport)
25{
26 UE_API void MakeInternal();
27
28 inline bool IsValid() const { return Id != 0; }
29 inline uint32 GetId() const { return Id; }
30
31 UE_API void* Render_GetUserData() const;
32
33protected:
34 FStateStreamHandle() = default;
40
44
45 UE_API bool operator==(const FStateStreamHandle& Other) const;
46
50};
51
52
54// StateStream handle owner.
55
57{
58public:
59 virtual void Game_AddRef(uint32 HandleId) = 0;
60 virtual void Game_Release(uint32 HandleId) = 0;
61 virtual void Game_Update(uint32 HandleId, const void* DynamicState, double TimeFactor, uint64 UserData) = 0;
62 virtual void* Game_Edit(uint32 HandleId, double TimeFactor, uint64 UserData) = 0;
63 virtual void* Render_GetUserData(uint32 HandleId) = 0;
64};
65
66
68// Copy context used to copy state stream handles.
69
74
75
77// Macro added by UHT to USTRUCT(StateStreamHandle) types
78
79#define DECLARE_STATESTREAM_HANDLE(Type) \
80 F##Type##Handle() = default; \
81 F##Type##Handle(const F##Type##Handle& Other) : FStateStreamHandle(Other) {} \
82 F##Type##Handle(F##Type##Handle&& Other) : FStateStreamHandle(std::move(Other)) {} \
83 F##Type##Handle& operator=(F##Type##Handle&& Other) { FStateStreamHandle::operator=(std::move(Other)); return *this; } \
84 F##Type##Handle& operator=(const F##Type##Handle& Other) { FStateStreamHandle::operator=(Other); return *this; } \
85 ~F##Type##Handle() = default; \
86 void Update(const F##Type##DynamicState& Ds, double TimeFactor = 0) { if (Owner) Owner->Game_Update(Id, &Ds, TimeFactor, 0); } \
87 F##Type##DynamicState& Edit(double TimeFactor = 0) { return *static_cast<F##Type##DynamicState*>(Owner->Game_Edit(Id, TimeFactor, 0)); } \
88 F##Type##Handle(IStateStreamHandleOwner& O, uint32 I) : FStateStreamHandle(O, I) {} \
89 F##Type##Handle(FStateStreamCopyContext& C, const F##Type##Handle& O) : FStateStreamHandle(C, O) {} \
90 void Apply(FStateStreamCopyContext& Context, const FStateStreamHandle& Other) { FStateStreamHandle::Apply(Context, Other); } \
91 bool operator==(const F##Type##Handle& Other) const { return FStateStreamHandle::operator==(Other); } \
92 static inline constexpr const TCHAR* DebugName = TEXT(#Type); \
93 using FStateStreamHandle::Apply; \
94 friend F##Type##DynamicState; \
95
97
98#undef UE_API
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
#define USTRUCT(...)
Definition ObjectMacros.h:746
#define UE_API
Definition StateStreamHandle.h:7
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition StateStreamHandle.h:57
virtual void * Game_Edit(uint32 HandleId, double TimeFactor, uint64 UserData)=0
virtual void * Render_GetUserData(uint32 HandleId)=0
virtual void Game_AddRef(uint32 HandleId)=0
virtual void Game_Update(uint32 HandleId, const void *DynamicState, double TimeFactor, uint64 UserData)=0
virtual void Game_Release(uint32 HandleId)=0
Definition StateStreamHandle.h:71
uint32 IsInternal
Definition StateStreamHandle.h:72
Definition StateStreamHandle.h:25
bool IsValid() const
Definition StateStreamHandle.h:28
FStateStreamHandle()=default
uint32 GetId() const
Definition StateStreamHandle.h:29