LkEngine 0.1.2
 
Loading...
Searching...
No Matches
TimerHandle.h
Go to the documentation of this file.
1
5#pragma once
6
9
10namespace LkEngine {
11
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. */
51namespace 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}
Core macros used by the entire engine.
Core types.
Definition TimerHandle.h:18
Definition TimerManager.h:40
Definition Asset.h:11
Definition UUID.h:33
Definition UUID.h:35