Table of Contents

Interface IRegistry<T>

Namespace
Core.Registries
Assembly
Core.dll

Base interface for all game entity registries Provides type-safe string-to-ID mapping and efficient array lookups Following data-linking-architecture.md specifications

public interface IRegistry<T> where T : class

Type Parameters

T

Properties

Count

Get the count of registered entities

int Count { get; }

Property Value

int

TypeName

Get the type name for error messages

string TypeName { get; }

Property Value

string

Methods

Exists(string)

Check if a key exists in the registry

bool Exists(string key)

Parameters

key string

Returns

bool

Exists(ushort)

Check if an ID exists in the registry

bool Exists(ushort id)

Parameters

id ushort

Returns

bool

Get(string)

Get entity by string key (O(1) hash lookup) Use only during loading phase, not at runtime

T Get(string key)

Parameters

key string

Returns

T

Get(ushort)

Get entity by numeric ID (O(1) array access) Primary runtime access method - no strings involved

T Get(ushort id)

Parameters

id ushort

Returns

T

GetAll()

Get all registered entities for iteration

IEnumerable<T> GetAll()

Returns

IEnumerable<T>

GetAllIds()

Get all registered IDs for iteration

IEnumerable<ushort> GetAllIds()

Returns

IEnumerable<ushort>

GetId(string)

Get numeric ID for a string key Returns 0 if key not found (0 reserved for "none/invalid")

ushort GetId(string key)

Parameters

key string

Returns

ushort

Register(string, T)

Register a new entity with a string key Returns the assigned numeric ID for efficient runtime access

ushort Register(string key, T item)

Parameters

key string
item T

Returns

ushort

TryGet(string, out T)

Try to get entity by string key without exceptions Returns false if key not found

bool TryGet(string key, out T item)

Parameters

key string
item T

Returns

bool

TryGetId(string, out ushort)

Try to get ID by string key without exceptions Returns false if key not found

bool TryGetId(string key, out ushort id)

Parameters

key string
id ushort

Returns

bool