CommonLibSSE NG
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 NodeRef& a_src) :
60 first(*a_src.first),
61 second(*a_src.second)
62 {}
63
64 void operator=(const NodeRef& a_src)
65 {
66 first = *a_src.first;
67 second = *a_src.second;
68 }
69
70 template <class K>
71 bool operator==(const K& a_src) const
72 {
73 return (first == a_src);
74 }
75
76 template <class K>
77 static UPInt CalcHash(const K& a_data)
78 {
79 return Hash()(a_data);
80 }
81
82 [[nodiscard]] inline UPInt GetHash() const
83 {
84 return Hash()(first);
85 }
86
87 // members
88 C first; // 00
89 U second; // ??
90 };
91}
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:59
bool operator==(const K &a_src) const
Definition GHashNode.h:71
U second
Definition GHashNode.h:89
UPInt GetHash() const
Definition GHashNode.h:82
U SecondType
Definition GHashNode.h:10
C FirstType
Definition GHashNode.h:9
static UPInt CalcHash(const K &a_data)
Definition GHashNode.h:77
C first
Definition GHashNode.h:88
void operator=(const NodeRef &a_src)
Definition GHashNode.h:64