UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ScopedCallback.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreTypes.h"
6
7
12template< class CallbackType >
14{
15public:
16
18 : Counter(0)
19 { }
20
23 {
24 if (HasRequests())
25 {
26 CallbackType::FireCallback();
27 }
28 }
29
31 void Request()
32 {
33 ++Counter;
34 }
35
37 void Unrequest()
38 {
39 --Counter;
40 }
41
47 bool HasRequests() const
48 {
49 return Counter > 0;
50 }
51
52private:
53
55 int32 Counter;
56};
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
Definition ScopedCallback.h:14
bool HasRequests() const
Definition ScopedCallback.h:47
void Request()
Definition ScopedCallback.h:31
TScopedCallback()
Definition ScopedCallback.h:17
void Unrequest()
Definition ScopedCallback.h:37
~TScopedCallback()
Definition ScopedCallback.h:22