Refactoring of player management and integration with the main window rendering

This commit is contained in:
Sylvain Schneider
2026-07-27 23:49:09 +02:00
parent cbe165aa85
commit ee6981bda3
34 changed files with 1122 additions and 181 deletions

View File

@@ -95,21 +95,7 @@ constexpr std::uint64_t fnv1a_64(std::span<const std::byte> data) noexcept;
* @param sv Input string view.
* @return std::uint64_t The 64-bit FNV-1a hash.
*/
constexpr std::uint64_t fnv1a_64(std::string_view sv) noexcept;
/**
* @brief Compute the FNV-1a 64-bit hash for a trivially copyable POD object.
*
* The object is hashed as its raw bytes (binary representation).
* Use only for POD/trivially-copyable types where this behaviour is intended.
*
* @tparam T Trivially copyable type.
* @param value Reference to the object to hash.
* @return std::uint64_t 64-bit FNV-1a hash.
*/
template<typename T>
requires std::is_trivially_copyable_v<T>
constexpr std::uint64_t fnv1a_64(const T &value) noexcept;
constexpr std::uint64_t fnv1a_64_sv(std::string_view sv) noexcept;
//--------------------------------------------------------------
//--------------------------------------------------------------
@@ -170,7 +156,7 @@ inline constexpr std::uint64_t fnv1a_64(const std::span<const std::byte> data) n
}
//--------------------------------------------------------------
/* Compute the FNV-1a 64-bit hash for a std::string_view */
inline constexpr std::uint64_t fnv1a_64(const std::string_view sv) noexcept
inline constexpr std::uint64_t fnv1a_64_sv(const std::string_view sv) noexcept
{
// Iterate characters to remain constexpr-friendly
constexpr std::uint64_t FNV_OFFSET_BASIS = 14695981039346656037ull;
@@ -185,14 +171,4 @@ inline constexpr std::uint64_t fnv1a_64(const std::string_view sv) noexcept
return hash;
}
//--------------------------------------------------------------
/* Compute the FNV-1a 64-bit hash for a trivially copyable POD object */
template<typename T>
requires std::is_trivially_copyable_v<T>
inline constexpr std::uint64_t fnv1a_64(const T &value) noexcept
{
// Use std::bit_cast to get bytes in a constexpr-friendly way
auto bytes = std::bit_cast<std::array<std::byte, sizeof(T)>>(value);
return fnv1a_64(std::span<const std::byte>(bytes.data(), bytes.size()));
}
//--------------------------------------------------------------
} // namespace sdi_toolBox::common::utils::hash