CommonLibSSE NG
GHashsetCachedNodeEntry.h
Go to the documentation of this file.
1 #pragma once
2 
3 namespace RE
4 {
5  template <class T, class Hash>
7  {
8  public:
10  nextInChain(-2),
11  hashValue(0),
12  value{}
13  {}
14 
16  nextInChain(a_entry.nextInChain),
17  hashValue(a_entry.hashValue),
18  value(a_entry.value)
19  {}
20 
21  GHashsetCachedNodeEntry(const T& a_key, SPInt a_next) :
22  nextInChain(a_next),
23  hashValue(0),
24  value(a_key)
25  {}
26 
27  GHashsetCachedNodeEntry(const typename T::NodeRef& a_keyRef, SPInt a_next) :
28  nextInChain(a_next),
29  hashValue(0),
30  value(a_keyRef)
31  {}
32 
33  [[nodiscard]] bool IsEmpty() const
34  {
35  return nextInChain == -2;
36  }
37 
38  [[nodiscard]] bool IsEndOfChain() const
39  {
40  return nextInChain == -1;
41  }
42 
43  [[nodiscard]] UPInt GetCachedHash([[maybe_unused]] UPInt a_maskValue) const
44  {
45  return hashValue;
46  }
47 
48  void SetCachedHash(UPInt a_hashValue)
49  {
50  hashValue = a_hashValue;
51  }
52 
53  void Clear()
54  {
55  value.~T();
56  nextInChain = -2;
57  }
58 
59  void Free()
60  {
61  Clear();
62  }
63 
64  // members
67  T value; // 10
68  };
69  // size == 0x10 + sizeof(T)
70 }
Definition: GHashsetCachedNodeEntry.h:7
bool IsEmpty() const
Definition: GHashsetCachedNodeEntry.h:33
void Free()
Definition: GHashsetCachedNodeEntry.h:59
bool IsEndOfChain() const
Definition: GHashsetCachedNodeEntry.h:38
T value
Definition: GHashsetCachedNodeEntry.h:67
UPInt GetCachedHash([[maybe_unused]] UPInt a_maskValue) const
Definition: GHashsetCachedNodeEntry.h:43
GHashsetCachedNodeEntry(const GHashsetCachedNodeEntry &a_entry)
Definition: GHashsetCachedNodeEntry.h:15
GHashsetCachedNodeEntry(const T &a_key, SPInt a_next)
Definition: GHashsetCachedNodeEntry.h:21
void SetCachedHash(UPInt a_hashValue)
Definition: GHashsetCachedNodeEntry.h:48
GHashsetCachedNodeEntry()
Definition: GHashsetCachedNodeEntry.h:9
void Clear()
Definition: GHashsetCachedNodeEntry.h:53
GHashsetCachedNodeEntry(const typename T::NodeRef &a_keyRef, SPInt a_next)
Definition: GHashsetCachedNodeEntry.h:27
SPInt nextInChain
Definition: GHashsetCachedNodeEntry.h:65
UPInt hashValue
Definition: GHashsetCachedNodeEntry.h:66
Definition: AbsorbEffect.h:6
std::size_t UPInt
Definition: SFTypes.h:5
std::ptrdiff_t SPInt
Definition: SFTypes.h:8