Deki 1.3.0
Modular C++ 2D engine for embedded displays and desktop
Loading...
Searching...
No Matches
ComponentInterfaceAdapters Namespace Reference

Functions

void Register (uint32_t interfaceId, ComponentType componentType, InterfaceAdapter adapter)
void * Query (uint32_t interfaceId, DekiComponent *comp)
InterfaceAdapter Find (uint32_t interfaceId, ComponentType componentType, ComponentType baseType)
 The adapter Query would call for a component of this type (exact type first, then its base type), or nullptr.
uint32_t Version ()
 Bumped by every Register.

Function Documentation

◆ Register()

void ComponentInterfaceAdapters::Register ( uint32_t interfaceId,
ComponentType componentType,
InterfaceAdapter adapter )

◆ Query()

void * ComponentInterfaceAdapters::Query ( uint32_t interfaceId,
DekiComponent * comp )

◆ Find()

InterfaceAdapter ComponentInterfaceAdapters::Find ( uint32_t interfaceId,
ComponentType componentType,
ComponentType baseType )

The adapter Query would call for a component of this type (exact type first, then its base type), or nullptr.

Lets a caller cache the function pointer per component type instead of hashing per component per frame; re-check whenever Version() changes.

◆ Version()

uint32_t ComponentInterfaceAdapters::Version ( )

Bumped by every Register.

A cache of Query results (the renderer keeps one per component type) compares it to notice adapters registered later, e.g. by a package that loaded after the cache was filled.