CommonLibSSE (Parapets fork)
Loading...
Searching...
No Matches
GHashNode.h
Go to the documentation of this file.
1#pragma once
2
3namespace RE
4{
5 template <class C, class U, class Hash>
6 struct GHashNode
7 {
9 using FirstType = C;
10 using SecondType = U;
11
12 struct NodeRef
13 {
14 const C* first; // 00
15 const U* second; // 08
16
17 NodeRef(const C& a_first, const U& a_second) :
18 first(&a_first),
19 second(&a_second)
20 {}
21
22 NodeRef(const NodeRef& a_src) :
23 first(a_src.first),
24 second(a_src.second)
25 {}
26
27 [[nodiscard]] inline UPInt GetHash() const
28 {
29 return Hash()(*first);
30 }
31
32 operator const C&() const
33 {
34 return *first;
35 }
36 };
37 static_assert(sizeof(NodeRef) == 0x10);
38
39 struct NodeHashF
40 {
41 template <class K>
42 UPInt operator()(const K& a_data) const
43 {
44 return a_data.GetHash();
45 }
46 };
47 static_assert(sizeof(NodeHashF) == 0x1);
48
50 {
51 template <class K>
52 UPInt operator()(const K& a_data) const
53 {
55 }
56 };
57 static_assert(sizeof(NodeAltHashF) == 0x1);
58
59 GHashNode(const GHashNode& a_src) :
60 first(a_src.first),
61 second(a_src.second)
62 {}
63
64 GHashNode(const NodeRef& a_src) :
65 first(*a_src.first),
66 second(*a_src.second)
67 {}
68
69 void operator=(const NodeRef& a_src)
70 {
71 first = *a_src.first;
72 second = *a_src.second;
73 }
74
75 template <class K>
76 bool operator==(const K& a_src) const
77 {
78 return (first == a_src);
79 }
80
81 template <class K>
82 static UPInt CalcHash(const K& a_data)
83 {
84 return Hash()(a_data);
85 }
86
87 [[nodiscard]] inline UPInt GetHash() const
88 {
89 return Hash()(first);
90 }
91
92 // members
93 C first; // 00
94 U second; // ??
95 };
96}
Definition: AbsorbEffect.h:6
std::size_t UPInt
Definition: SFTypes.h:5
Definition: GHashNode.h:50
UPInt operator()(const K &a_data) const
Definition: GHashNode.h:52
Definition: GHashNode.h:40
UPInt operator()(const K &a_data) const
Definition: GHashNode.h:42
Definition: GHashNode.h:13
UPInt GetHash() const
Definition: GHashNode.h:27
NodeRef(const NodeRef &a_src)
Definition: GHashNode.h:22
const C * first
Definition: GHashNode.h:14
const U * second
Definition: GHashNode.h:15
NodeRef(const C &a_first, const U &a_second)
Definition: GHashNode.h:17
Definition: GHashNode.h:7
GHashNode(const NodeRef &a_src)
Definition: GHashNode.h:64
bool operator==(const K &a_src) const
Definition: GHashNode.h:76
U second
Definition: GHashNode.h:94
UPInt GetHash() const
Definition: GHashNode.h:87
U SecondType
Definition: GHashNode.h:10
C FirstType
Definition: GHashNode.h:9
static UPInt CalcHash(const K &a_data)
Definition: GHashNode.h:82
C first
Definition: GHashNode.h:93
void operator=(const NodeRef &a_src)
Definition: GHashNode.h:69
GHashNode(const GHashNode &a_src)
Definition: GHashNode.h:59