Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
esengine::detail Namespace Reference

Typedefs

using VerifyHook = void (*)(const char* cond, const char* file, int line)
 Optional sink invoked whenever an ES_VERIFY condition fails.

Functions

bool boundaryContains (uintptr_t ptr, u64 bytes, uintptr_t *base, u64 *size)
VerifyHook & verifyHook ()
template<typename Domain>
std::atomic< TypeId > & typeIdCounter ()
 One independent TypeId counter per Domain tag.
template<typename Domain, typename T>
TypeId domainTypeId ()

Variables

uintptr_t g_boundaryBase = 0
usize g_boundarySize = 0

Typedef Documentation

◆ VerifyHook

using esengine::detail::VerifyHook = void (*)(const char* cond, const char* file, int line)

Optional sink invoked whenever an ES_VERIFY condition fails.

ES_VERIFY always logs + recovers (in both debug and release). This hook makes a failure observable: release-mode safety tests install a counter to assert "the guard fired and we degraded gracefully", and a dev build can install an aborting hook to fail loudly. Default is null (log + recover only). Not thread-safe to set — install once at startup or from a single-threaded test.

Definition at line 347 of file Log.hpp.

Function Documentation

◆ boundaryContains()

bool esengine::detail::boundaryContains ( uintptr_t ptr,
u64 bytes,
uintptr_t * base,
u64 * size )
inline

Whether [ptr, ptr+bytes) is inside the memory JS can legitimately address. Reports the region it checked against, so a rejection names what it compared.

Definition at line 44 of file BoundarySpan.hpp.

References g_boundaryBase, and g_boundarySize.

Referenced by esengine::boundarySpan().

◆ domainTypeId()

template<typename Domain, typename T>
TypeId esengine::detail::domainTypeId ( )
inline

Definition at line 208 of file Types.hpp.

References typeIdCounter().

Referenced by esengine::componentTypeId(), and esengine::serviceTypeId().

◆ typeIdCounter()

template<typename Domain>
std::atomic< TypeId > & esengine::detail::typeIdCounter ( )
inline

One independent TypeId counter per Domain tag.

A single global counter shared across unrelated concerns (components, events, services, resources) coupled them: a component's id depended on how many events/services happened to be instantiated first. Because the ECS uses the component id as a pools_ vector index AND a per-entity bitmask bit, an inflated id wasted memory and could overflow the 128-bit inline mask. Per-domain counters keep each domain's ids dense and 0-based.

Note
Internal use only.

Definition at line 202 of file Types.hpp.

Referenced by domainTypeId().

◆ verifyHook()

VerifyHook & esengine::detail::verifyHook ( )
inline

Definition at line 349 of file Log.hpp.

Variable Documentation

◆ g_boundaryBase

uintptr_t esengine::detail::g_boundaryBase = 0
inline

Definition at line 38 of file BoundarySpan.hpp.

Referenced by boundaryContains(), and esengine::setBoundaryRegion().

◆ g_boundarySize

usize esengine::detail::g_boundarySize = 0
inline

Definition at line 39 of file BoundarySpan.hpp.

Referenced by boundaryContains(), and esengine::setBoundaryRegion().