string_id.h
| File Path | engine/include/conjure/core/string_id.h |
| API ↗ | Containers, Strings and identifiers |
A string reduced to its 64-bit FNV-1a hash. Trivially copyable and comparable by hash; the original spelling is available through view()/c_str() once the id has been interned. Meant for bounded vocabularies: an interned name is never freed, so unique per-spawn names grow memory for the life of the process (see the header comment).
Structs
| File | Description |
|---|---|
std::formatter<conjure::core::string_id> |
|
std::hash<conjure::core::string_id> |
Classes
| File | Description |
|---|---|
string_id |
A string reduced to its 64-bit FNV-1a hash. Trivially copyable and comparable by hash; the original spelling is available through view()/c_str() once the id has been interned. Meant for bounded vocabularies: an interned name is never freed, so unique per-spawn names grow memory for the life of the process (see the header comment). |
Functions
Public
detail::find_string_id_name
detail::find_string_id_name[[nodiscard]] CONJURE_API std::string_view find_string_id_name(u64 hash) noexcept;The registered spelling of hash, or an empty, null-terminated view when unknown. The returned view stays valid for the lifetime of the process. Thread-safe.
detail::register_string_id_name
detail::register_string_id_nameCONJURE_API void register_string_id_name(u64 hash, std::string_view name);Records name as the spelling of hash. Interning a different name under a hash that is already registered is a collision: it asserts, logs an ERROR on LOG_CORE and keeps the first name. Thread-safe. Exposed so tests and tooling can exercise the table directly.
detail::string_id_name_count
detail::string_id_name_count[[nodiscard]] CONJURE_API usize string_id_name_count() noexcept;Number of distinct hashes with a registered name. Thread-safe.
literals::operator""_sid
literals::operator""_sid"ecs.component"_sid: a string_id from a literal. Always evaluated at compile time, so it never interns the name and never takes the table mutex; intern() the name once elsewhere if tools must be able to resolve it.