Deki 1.3.0
Modular C++ 2D engine for embedded displays and desktop
Loading...
Searching...
No Matches
DekiComponent.h File Reference

Classes

class  DekiComponent
 Base class for all components (data-only). More...

Namespaces

namespace  SceneFormat

Macros

#define DECLARE_COMPONENT_TYPE(TypeName, BaseTypeName)
 Declare component type with consistent type ID across translation units.

Typedefs

using ComponentType = uint32_t
 Type alias for component type identification.

Functions

constexpr uint32_t DekiHashString (const char *str, uint32_t hash=2166136261u)
 Compile-time string hash for consistent type IDs across translation units.
uint32_t DekiHashStringLen (const char *str, uint16_t length)
 Runtime string hash with length (for msgpack strings without null terminator).

Macro Definition Documentation

◆ DECLARE_COMPONENT_TYPE

#define DECLARE_COMPONENT_TYPE ( TypeName,
BaseTypeName )
Value:
static constexpr ComponentType StaticType = DekiHashString(#TypeName); \
static constexpr ComponentType BaseStaticType = BaseTypeName::StaticType; \
ComponentType GetType() const override \
{ \
return StaticType; \
} \
ComponentType GetBaseType() const override \
{ \
return BaseStaticType; \
}
constexpr uint32_t DekiHashString(const char *str, uint32_t hash=2166136261u)
Compile-time string hash for consistent type IDs across translation units.
Definition DekiComponent.h:22
uint32_t ComponentType
Type alias for component type identification.
Definition DekiComponent.h:9

Declare component type with consistent type ID across translation units.

Uses FNV-1a hash of the type name to generate a unique, stable type ID. This ensures the same type ID is generated regardless of which .cpp file includes the header.

Typedef Documentation

◆ ComponentType

using ComponentType = uint32_t

Type alias for component type identification.

Function Documentation

◆ DekiHashString()

uint32_t DekiHashString ( const char * str,
uint32_t hash = 2166136261u )
constexpr

Compile-time string hash for consistent type IDs across translation units.

◆ DekiHashStringLen()

uint32_t DekiHashStringLen ( const char * str,
uint16_t length )
inline

Runtime string hash with length (for msgpack strings without null terminator).