CommonLibVR
GHashsetNodeEntry.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  {}
12 
14  nextInChain(a_entry.nextInChain),
15  value(a_entry.value)
16  {}
17 
18  GHashsetNodeEntry(const T& a_key, SPInt a_next) :
19  nextInChain(a_next),
20  value(a_key)
21  {}
22 
23  GHashsetNodeEntry(const typename T::NodeRef& a_keyRef, SPInt a_next) :
24  nextInChain(a_next),
25  value(a_keyRef)
26  {}
27 
28  [[nodiscard]] bool IsEmpty() const
29  {
30  return nextInChain == -2;
31  }
32 
33  [[nodiscard]] bool IsEndOfChain() const
34  {
35  return nextInChain == -1;
36  }
37 
38  [[nodiscard]] UPInt GetCachedHash(UPInt a_maskValue) const
39  {
40  return Hash()(value) & a_maskValue;
41  }
42 
43  void SetCachedHash([[maybe_unused]] UPInt a_hashValue)
44  {}
45 
46  void Clear()
47  {
48  value.~T();
49  nextInChain = -2;
50  }
51 
52  void Free()
53  {
54  Clear();
55  }
56 
57  // members
59  T value; // 08
60  private:
61  KEEP_FOR_RE()
62  };
63  // size == 0x8 + sizeof(T)
64 }
#define KEEP_FOR_RE()
Definition: PCH.h:713
Definition: GHashsetNodeEntry.h:7
void SetCachedHash([[maybe_unused]] UPInt a_hashValue)
Definition: GHashsetNodeEntry.h:43
void Free()
Definition: GHashsetNodeEntry.h:52
GHashsetNodeEntry()
Definition: GHashsetNodeEntry.h:9
T value
Definition: GHashsetNodeEntry.h:59
bool IsEmpty() const
Definition: GHashsetNodeEntry.h:28
bool IsEndOfChain() const
Definition: GHashsetNodeEntry.h:33
GHashsetNodeEntry(const GHashsetNodeEntry &a_entry)
Definition: GHashsetNodeEntry.h:13
void Clear()
Definition: GHashsetNodeEntry.h:46
SPInt nextInChain
Definition: GHashsetNodeEntry.h:58
UPInt GetCachedHash(UPInt a_maskValue) const
Definition: GHashsetNodeEntry.h:38
GHashsetNodeEntry(const typename T::NodeRef &a_keyRef, SPInt a_next)
Definition: GHashsetNodeEntry.h:23
GHashsetNodeEntry(const T &a_key, SPInt a_next)
Definition: GHashsetNodeEntry.h:18
Definition: AbsorbEffect.h:6
std::size_t UPInt
Definition: SFTypes.h:5
std::ptrdiff_t SPInt
Definition: SFTypes.h:8