Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
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
8
/**
9
* Helper object for batching callback requests and firing on destruction of the FScopedCallback object.
10
* CallbackType is a class implementing a static method called FireCallback, which does the work.
11
*/
12
template
<
class
CallbackType >
13
class
TScopedCallback
14
{
15
public
:
16
17
TScopedCallback
()
18
:
Counter
(0)
19
{ }
20
21
/** Fires a callback if outstanding requests exist. */
22
~
TScopedCallback
()
23
{
24
if
(
HasRequests
())
25
{
26
CallbackType
::
FireCallback
();
27
}
28
}
29
30
/** Request a callback. */
31
void
Request
()
32
{
33
++
Counter
;
34
}
35
36
/** Unrequest a callback. */
37
void
Unrequest
()
38
{
39
--
Counter
;
40
}
41
42
/**
43
* Checks whether this callback has outstanding requests.
44
*
45
* @return true if there are outstanding requests, false otherwise.
46
*/
47
bool
HasRequests
()
const
48
{
49
return
Counter
> 0;
50
}
51
52
private
:
53
54
/** Counts callback requests. */
55
int32
Counter
;
56
};
TScopedCallback
Definition
ScopedCallback.h:14
TScopedCallback::HasRequests
bool HasRequests() const
Definition
ScopedCallback.h:47
TScopedCallback::Request
void Request()
Definition
ScopedCallback.h:31
TScopedCallback::TScopedCallback
TScopedCallback()
Definition
ScopedCallback.h:17
TScopedCallback::Unrequest
void Unrequest()
Definition
ScopedCallback.h:37
TScopedCallback::Counter
int32 Counter
Definition
ScopedCallback.h:55
TScopedCallback::~TScopedCallback
~TScopedCallback()
Definition
ScopedCallback.h:22
Downloads
ArkServerAPI_NEW
ASA
AsaApi
AsaApi
Core
Public
API
UE
Templates
ScopedCallback.h
Generated by
1.10.0