Skip to main content

EntityRegistry

EntityRegistry

Central registry of session-scoped entity identifiers. More…

#include <EntityRegistry.hpp>

Public Functions

Name
EntityId ensureId(std::string const & data_key, EntityKind kind, TimeFrameIndex const & time, int local_index)
Get or create an EntityId for the tuple.
std::optional< EntityDescriptor > get(EntityId id) const
Lookup descriptor for an EntityId.
void rebindKey(EntityId id, TimeFrameIndex const & time, int local_index)
Rebind an existing EntityId to a new (time, local_index) tuple.
void clear()
Clear all registered entities (session reset).

Detailed Description

class EntityRegistry;

Central registry of session-scoped entity identifiers.

Provides deterministic, session-local mapping between (data_key, kind, time, local_index) tuples and opaque EntityId values. Thread-safe for concurrent access.

Public Functions Documentation

function ensureId

EntityId ensureId(
    std::string const & data_key,
    EntityKind kind,
    TimeFrameIndex const & time,
    int local_index
)

Get or create an EntityId for the tuple.

Parameters:

  • data_key Logical key for the data object (opaque; empty allowed)
  • kind Entity kind (Point, Line, Event, Interval, Mask, TimeEntity)
  • time TimeFrameIndex for the entity
  • local_index Stable 0-based index within that time. For IntervalEntity, this is the interval end time (not a storage index).

Return: EntityId for the tuple; same tuple always returns the same id

Note: Thread-safe

Precondition: local_index >= 0 (enforcement: assert)

function get

std::optional< EntityDescriptor > get(
    EntityId id
) const

Lookup descriptor for an EntityId.

Parameters:

  • id EntityId to look up (e.g. from ensureId or from group/lineage).

Return: EntityDescriptor if the id was ever produced by ensureId on this registry, otherwise std::nullopt. No preconditions on id; unknown ids return nullopt.

Note: Thread-safe

function rebindKey

void rebindKey(
    EntityId id,
    TimeFrameIndex const & time,
    int local_index
)

Rebind an existing EntityId to a new (time, local_index) tuple.

Parameters:

  • id EntityId previously allocated by ensureId on this registry
  • time New TimeFrameIndex for the entity
  • local_index New local_index (interval end for IntervalEntity)

Note: Thread-safe; no-op if id is unknown

Precondition:

  • local_index >= 0 (enforcement: assert)
  • id was previously registered via ensureId

Updates both lookup maps so ensureId on the new tuple returns the same id. Used when interval bounds change but the logical entity identity is preserved.

function clear

void clear()

Clear all registered entities (session reset).

Note: Thread-safe


Updated on 2026-11-13 at 20:25:40 +0000