UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
TypedElementIndexHasher.inl
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "Hash/CityHash.h"
7
9{
10 template<typename T>
12 {
13 return reinterpret_cast<IndexHash>(Object);
14 }
15
16 template<typename T>
18 {
19 return GenerateIndexHash(Object.Get());
20 }
21
22 template<typename T>
24 {
25 return GenerateIndexHash(Object.Get());
26 }
27
28 template<typename T>
30 {
31 return GenerateIndexHash(Object.Get());
32 }
33
34 IndexHash GenerateIndexHash(const FString& Object)
35 {
36 return CityHash64(reinterpret_cast<const char*>(*Object), Object.Len() * sizeof(**Object));
37 }
38
40 {
41 return CityHash64(reinterpret_cast<const char*>(Object.GetData()), Object.Len() * sizeof(*Object.GetData()));
42 }
43
45 {
46 constexpr static const char SeedName[] = "FName";
47 static uint64 Seed = CityHash64(SeedName, sizeof(SeedName) - 1);
48 return CityHash128to64({ Seed, Object.ToUnstableInt() });
49 }
50
52 {
53 constexpr static const char SeedName[] = "FSoftObjectPath";
54 static uint64 Seed = CityHash64(SeedName, sizeof(SeedName) - 1);
55
56 FTopLevelAssetPath TopLevelAssetPath = ObjectPath.GetAssetPath();
58 Hash = CityHash128to64({ Hash, GenerateIndexHash(TopLevelAssetPath.GetAssetName()) });
59 return CityHash128to64({ Hash, GenerateIndexHash(ObjectPath.GetSubPathString()) });
60 }
61} // namespace UE::Editor::DataStorage
uint64 CityHash64(const char *s, uint32 len)
Definition CityHash.cpp:388
uint64 CityHash128to64(const Uint128_64 &x)
Definition CityHash.h:95
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition Platform.h:1117
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
Definition NameTypes.h:617
Definition StrongObjectPtrTemplates.h:26
Definition CommonTypes.cpp:10
uint64 IndexHash
Definition Types.h:11
IndexHash GenerateIndexHash(const T *Object)
Definition TypedElementIndexHasher.inl:11
Definition SoftObjectPath.h:56
Definition TopLevelAssetPath.h:38
FName GetPackageName() const
Definition TopLevelAssetPath.h:92
FName GetAssetName() const
Definition TopLevelAssetPath.h:95
Definition ObjectPtr.h:488
Definition WeakObjectPtrTemplates.h:25