UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
MaterialRecursionGuard.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3/*=============================================================================
4 MaterialShared.h: Shared material definitions.
5=============================================================================*/
6
7#pragma once
8
9template<typename T>
11{
12 inline TMaterialRecursionGuard() = default;
14 : Value(nullptr)
15 , PreviousLink(&Parent)
16 {
17 }
18
19 inline void Set(const T* InValue)
20 {
21 check(Value == nullptr);
22 Value = InValue;
23 }
24
25 inline bool Contains(const T* InValue)
26 {
27 TMaterialRecursionGuard const* Link = this;
28 do
29 {
30 if (Link->Value == InValue)
31 {
32 return true;
33 }
34 Link = Link->PreviousLink;
35 } while (Link);
36 return false;
37 }
38
39private:
40 const T* Value = nullptr;
41 TMaterialRecursionGuard const* PreviousLink = nullptr;
42};
#define check(expr)
Definition AssertionMacros.h:314
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
Definition MaterialRecursionGuard.h:11
TMaterialRecursionGuard(const TMaterialRecursionGuard &Parent)
Definition MaterialRecursionGuard.h:13
bool Contains(const T *InValue)
Definition MaterialRecursionGuard.h:25
void Set(const T *InValue)
Definition MaterialRecursionGuard.h:19
TMaterialRecursionGuard()=default