DEKI/ENGINE docs
manual api reference
Deki 0.40.1
Modular C++ engine with a visual editor, for 2D and 3D
Loading...
Searching...
No Matches
Deki::AssetLookupTable Class Reference

Maps "path:type" keys to asset GUIDs with a binary search and no heap allocation. More...

#include <deki/assets/AssetLookupTable.h>

Static Public Member Functions

static bool ContainsGuid (const char *guid)
 True when any entry holds guid.
static uint32_t GetEntryCount ()
static uint32_t Hash (const char *path, const char *type)
 FNV-1a hash of the key "path:type", such as "scenes/Demo:Scene".
static uint32_t HashString (const char *str)
 FNV-1a hash of str.
static bool IsLoaded ()
static bool Load (const uint8_t *data, size_t size)
 Uses the table in data, which must stay valid while lookups run (it is not copied).
static const char * Lookup (uint32_t hash)
 The GUID for hash (from Hash()), or nullptr when not found.
static void Unload ()

Detailed Description

Maps "path:type" keys to asset GUIDs with a binary search and no heap allocation.

Member Function Documentation

◆ ContainsGuid()

bool Deki::AssetLookupTable::ContainsGuid ( const char * guid)
static

True when any entry holds guid.

A linear scan: fine at asset load, too slow per frame.

◆ GetEntryCount()

uint32_t Deki::AssetLookupTable::GetEntryCount ( )
inlinestatic

◆ Hash()

uint32_t Deki::AssetLookupTable::Hash ( const char * path,
const char * type )
static

FNV-1a hash of the key "path:type", such as "scenes/Demo:Scene".

◆ HashString()

uint32_t Deki::AssetLookupTable::HashString ( const char * str)
static

FNV-1a hash of str.

◆ IsLoaded()

bool Deki::AssetLookupTable::IsLoaded ( )
inlinestatic

◆ Load()

bool Deki::AssetLookupTable::Load ( const uint8_t * data,
size_t size )
static

Uses the table in data, which must stay valid while lookups run (it is not copied).

Returns false when the data is not a valid table.

◆ Lookup()

const char * Deki::AssetLookupTable::Lookup ( uint32_t hash)
static

The GUID for hash (from Hash()), or nullptr when not found.

◆ Unload()

void Deki::AssetLookupTable::Unload ( )
static

The documentation for this class was generated from the following file: