Go to the documentation of this file.
34 #include "../../Primitives/interface/Errors.hpp"
35 #include "../../Platforms/Basic/interface/DebugUtilities.hpp"
37 #define LOG_HASH_CONFLICTS 1
46 Seed ^= std::hash<T>{}(Val) + 0x9e3779b9 + (Seed << 6) + (Seed >> 2);
49 template <
typename FirstArgType,
typename... RestArgsType>
50 void HashCombine(std::size_t& Seed,
const FirstArgType& FirstArg,
const RestArgsType&... RestArgs)
56 template <
typename... ArgsType>
64 template <
typename CharType>
71 while (
size_t Ch = *(str++))
72 Seed = Seed * 65599 + Ch;
77 template <
typename CharType>
80 bool operator()(
const CharType* str1,
const CharType* str2)
const
82 UNSUPPORTED(
"Template specialization is not implemented");
92 return strcmp(str1, str2) == 0;
108 VERIFY(
Str,
"String pointer must not be null");
113 auto LenWithZeroTerm = strlen(
Str) + 1;
114 auto* StrCopy =
new char[LenWithZeroTerm];
115 memcpy(StrCopy,
Str, LenWithZeroTerm);
134 Key.Ownership_Hash = 0;
161 else if (RHS.
Str ==
nullptr)
175 bool IsEqual = strcmp(
Str, RHS.
Str) == 0;
177 #if LOG_HASH_CONFLICTS
178 if (!IsEqual && Hash == RHSHash)
181 "\" have the same hash. You may want to use a better hash function. "
182 "You may disable this warning by defining LOG_HASH_CONFLICTS to 0");
190 return !(*
this == RHS);
HashMapStringKey & operator=(const HashMapStringKey &)=delete
char Char
Definition: BasicTypes.h:64
Definition: HashUtils.hpp:65
const Char * Str
Definition: HashUtils.hpp:216
size_t operator()(const HashMapStringKey &Key) const
Definition: HashUtils.hpp:205
bool operator()(const CharType *str1, const CharType *str2) const
Definition: HashUtils.hpp:80
HashMapStringKey(HashMapStringKey &&Key) noexcept
Definition: HashUtils.hpp:127
bool operator!=(const HashMapStringKey &RHS) const
Definition: HashUtils.hpp:188
#define UNSUPPORTED(...)
Definition: DebugUtilities.hpp:78
bool operator==(const HashMapStringKey &RHS) const
Definition: HashUtils.hpp:151
size_t operator()(const CharType *str) const
Definition: HashUtils.hpp:67
const Char * GetStr() const
Definition: HashUtils.hpp:198
~HashMapStringKey()
Definition: HashUtils.hpp:137
Definition: HashUtils.hpp:78
std::size_t ComputeHash(const ArgsType &... Args)
Definition: HashUtils.hpp:57
HashMapStringKey(const String &Str)
Definition: HashUtils.hpp:122
#define LOG_WARNING_MESSAGE(...)
Definition: Errors.hpp:123
This helper structure is intended to facilitate using strings as a hash table key....
Definition: HashUtils.hpp:100
std::basic_string< Char > String
String variable.
Definition: BasicTypes.h:66
#define VERIFY_EXPR(...)
Definition: DebugUtilities.hpp:79
#define VERIFY(...)
Definition: DebugUtilities.hpp:76
static constexpr size_t StrOwnershipMask
Definition: HashUtils.hpp:213
size_t Ownership_Hash
Definition: HashUtils.hpp:218
HashMapStringKey(const Char *_Str, bool bMakeCopy=false)
Definition: HashUtils.hpp:105
static constexpr size_t HashMask
Definition: HashUtils.hpp:214
Definition: HashUtils.hpp:203
void HashCombine(std::size_t &Seed, const T &Val)
Definition: HashUtils.hpp:44
static constexpr size_t StrOwnershipBit
Definition: HashUtils.hpp:212
bool operator()(const Char *str1, const Char *str2) const
Definition: HashUtils.hpp:90
size_t GetHash() const
Definition: HashUtils.hpp:193
The library uses Direct3D-style math:
Definition: AdvancedMath.hpp:37