Skip to content

Struct star::KeyRegistry

ClassList > star > KeyRegistry

Global key registry using data-oriented design (Structure of Arrays). More...

  • #include <stards.h>

Public Attributes

Type Name
std::unordered_map< uint64_t, uint16_t > hash_to_index
std::vector< uint64_t > hashes
std::unordered_map< std::string, uint16_t > name_to_index
std::vector< std::string > names

Public Functions

Type Name
bool contains (const std::string & key) const
Check if key exists in registry.
uint16_t get_index (const std::string & key) const
Get existing key index (throws if not found).
uint16_t get_or_create (const std::string & key)
Get or create a key index.

Detailed Description

Stores all unique keys once with precomputed hashes for O(1) lookups. Keys are referenced by uint16 indices throughout the system.

Public Attributes Documentation

variable hash_to_index

std::unordered_map<uint64_t, uint16_t> star::KeyRegistry::hash_to_index;

variable hashes

std::vector<uint64_t> star::KeyRegistry::hashes;

variable name_to_index

std::unordered_map<std::string, uint16_t> star::KeyRegistry::name_to_index;

variable names

std::vector<std::string> star::KeyRegistry::names;

Public Functions Documentation

function contains

Check if key exists in registry.

inline bool star::KeyRegistry::contains (
    const std::string & key
) const


function get_index

Get existing key index (throws if not found).

inline uint16_t star::KeyRegistry::get_index (
    const std::string & key
) const

Returns:

uint16 index into the registry


function get_or_create

Get or create a key index.

inline uint16_t star::KeyRegistry::get_or_create (
    const std::string & key
) 

Returns:

uint16 index into the registry



The documentation for this class was generated from the following file StarDS/include/stards.h