LkEngine
0.1.2
Loading...
Searching...
No Matches
TimerHandle.h
Go to the documentation of this file.
1
5
#pragma once
6
7
#include "
LkEngine/Core/CoreMacros.h
"
8
#include "
LkEngine/Core/CoreTypes.h
"
9
10
namespace
LkEngine
{
11
17
class
FTimerHandle
18
{
19
public
:
20
FTimerHandle
() : ID(Counter++) {}
21
FTimerHandle
(
const
uint64_t InID) : ID(InID) {}
22
23
FORCEINLINE uint64_t GetID()
const
{
return
ID; }
24
FORCEINLINE
bool
IsValid()
const
{
return
(ID != 0); }
25
26
FORCEINLINE
bool
operator==(
const
FTimerHandle
& Other)
const
27
{
28
return
(ID == Other.ID);
29
}
30
31
FORCEINLINE
void
Invalidate() { ID = 0; }
32
33
private
:
37
static
FTimerHandle
CreateHandle() {
return
FTimerHandle
{ ++Counter }; }
38
39
private
:
40
uint64_t ID = 0;
41
42
inline
static
uint64_t Counter = 0;
43
44
friend
class
LTimerManager
;
45
};
46
47
}
48
49
50
/* Provide hash implementation for FTimerHandle. */
51
namespace
std
52
{
53
template
<>
54
struct
hash
<
LkEngine
::FTimerHandle>
55
{
56
std::size_t operator()(
const
LkEngine::FTimerHandle
& TimerHandle)
const
noexcept
57
{
58
return
std::hash<uint64_t>
()(TimerHandle.GetID());
59
}
60
};
61
}
CoreMacros.h
Core macros used by the entire engine.
CoreTypes.h
Core types.
LkEngine::FTimerHandle
Definition
TimerHandle.h:18
LkEngine::LTimerManager
Definition
TimerManager.h:40
LkEngine
Definition
Asset.h:11
std
Definition
UUID.h:33
std::hash
Definition
UUID.h:35
LkEngine
Source
LkEngine
Core
Time
TimerHandle.h
Generated by
1.12.0