DEKI/ENGINE docs
Deki 0.19.0
Modular C++ 2D engine for embedded displays and desktop
Loading...
Searching...
No Matches
Deki::Memory::Region Struct Reference

Where an allocation lives. More...

#include <deki/providers/Memory.h>

Public Member Functions

constexpr Region (const char *regionName)
constexpr bool operator== (const Region &other) const
constexpr bool operator!= (const Region &other) const

Public Attributes

uint32_t id
 HashName(name); what the provider dispatches on.
const char * name
 what a failure prints

Friends

class Memory

Detailed Description

Where an allocation lives.

The caller says; the engine never guesses.

A region is a name, not an enumerator, so packages can define new ones without an engine change, in their own namespace:

namespace DekiEsp32
{
inline constexpr Deki::Memory::Region Rtc{"esp32.rtc"};
}

A region's identity is its hashed name, so the namespace it is declared in does not matter, and two packages' "Rtc" constants cannot collide.

Only the board's IMemoryProvider can serve a region; one that does not know "esp32.rtc" returns nullptr and names it. A package that allocates from Region("esp32.rtc") declares platformRequires ["memory:esp32.rtc"], so the build refuses a target without it before anything runs.

The name pointer is kept, not copied: a Region is only built from a string literal, which has static storage.

Constructor & Destructor Documentation

◆ Region()

Deki::Memory::Region::Region ( const char * regionName)
inlineexplicitconstexpr

Member Function Documentation

◆ operator==()

bool Deki::Memory::Region::operator== ( const Region & other) const
inlineconstexpr

◆ operator!=()

bool Deki::Memory::Region::operator!= ( const Region & other) const
inlineconstexpr

◆ Memory

friend class Memory
friend

Member Data Documentation

◆ id

uint32_t Deki::Memory::Region::id

HashName(name); what the provider dispatches on.

◆ name

const char* Deki::Memory::Region::name

what a failure prints


The documentation for this struct was generated from the following file:
  • deki-engine/include/deki/providers/Memory.h