Skip to content

Engine → Scene → guid_index.h

guid_index

Syntax

class CONJURE_API guid_index

Constructors

AccessSignatureDescription
publicguid_index();

Important

Copy constructor and assignment has been deleted.

Destructors

AccessSignatureDescription
public~guid_index();

Variables

AccessNameTypeDefaultDescription
publicINITIAL_CAPACITYstatic constexpr u321024Entries reserved by the constructor so small scenes never rehash.
privatemEntriescore::flat_hash_map<core::uuid, ecs::entity>{}

Functions

Public

capacity

[[nodiscard]] usize capacity() const noexcept;

Buckets of the underlying table (for the allocation tests).

clear

void clear() noexcept;

Drops every mapping; the capacity stays.

contains

[[nodiscard]] bool contains(
    const core::uuid &id) const noexcept;

True when the guid is mapped.

erase

void erase(
    const core::uuid &id,
    ecs::entity expected) noexcept;

Removes the mapping when it points at expected; any other mapping is left alone.

find

[[nodiscard]] ecs::entity find(
    const core::uuid &id) const noexcept;

The entity mapped to the guid, or NULL_ENTITY.

insert

[[nodiscard]] bool insert(
    const core::uuid &id,
    ecs::entity target);

Maps the guid to the entity. Returns false (and keeps the existing mapping) when the guid is already mapped; a null guid is never inserted.

rebind

void rebind(
    ecs::entity target,
    const core::uuid &oldId,
    const core::uuid &newId);

Moves an entity from one guid to another: erases oldId when it maps to the entity and inserts newId (first mapping wins when newId is taken).

reserve

void reserve(
    u32 count);

Makes room for count mappings so the next insertions never rehash.

size

[[nodiscard]] u32 size() const noexcept;

Number of mappings.