DigitalEventStorageBase
DigitalEventStorageBase
CRTP base class for digital event storage implementations. More…
#include <DigitalEventStorageBase.hpp>
Public Functions
| Name | |
|---|---|
| size_t | size() const Get total number of events. |
| bool | empty() const Check if storage is empty. |
| TimeFrameIndex | getEvent(size_t idx) const Get the event time at a flat index. |
| EntityId | getEntityId(size_t idx) const Get the EntityId at a flat index. |
| std::optional< size_t > | findByTime(TimeFrameIndex time) const Find the index of an event by its exact time. |
| std::optional< size_t > | findByEntityId(EntityId id) const Find the index of an event by its EntityId. |
| bool | hasEventAtTime(TimeFrameIndex time) const Check if an event exists at a specific time. |
| std::pair< size_t, size_t > | getTimeRange(TimeFrameIndex start, TimeFrameIndex end) const Get range of indices for events in [start, end] inclusive. |
| DigitalEventTimeDomain | getTimeDomain() const Get the time coordinate domain for this storage. |
| bool | isRelative() const Check if events are stored as relative ClockTicks. |
| ClockTicks | getRelativeEvent(size_t idx) const Get the relative event time at a flat index. |
| std::optional< size_t > | findByRelativeTime(ClockTicks time) const Find the index of an event by its exact relative time. |
| std::pair< size_t, size_t > | getRelativeTimeRange(ClockTicks start, ClockTicks end) const Get range of indices for events in [start, end] inclusive (relative time). |
| DigitalEventStorageType | getStorageType() const Get the storage type identifier. |
| bool | isView() const Check if this is a view (doesn’t own data). |
| bool | isLazy() const Check if this is lazy storage. |
| bool | isRelativeOwning() const Check if this is relative owning storage. |
| DigitalEventStorageCache | tryGetCache() const Try to get cached pointers for fast-path access. |
Protected Functions
| Name | |
|---|---|
| ~DigitalEventStorageBase() =default |
Detailed Description
template <typename Derived >
class DigitalEventStorageBase;CRTP base class for digital event storage implementations.
Template Parameters:
- Derived The concrete storage implementation type.
Uses Curiously Recurring Template Pattern to eliminate virtual function overhead while maintaining a polymorphic-like interface. Events are stored as TimeFrameIndex values (representing event times) with associated EntityIds.
The SoA (Structure of Arrays) layout stores parallel vectors:
- TimeFrameIndex events[] - sorted event times
- EntityId entity_ids[] - corresponding entity identifiers
Public Functions Documentation
function size
inline size_t size() constGet total number of events.
function empty
inline bool empty() constCheck if storage is empty.
function getEvent
inline TimeFrameIndex getEvent(
size_t idx
) constGet the event time at a flat index.
Parameters:
- idx Flat index in [0, size()).
function getEntityId
inline EntityId getEntityId(
size_t idx
) constGet the EntityId at a flat index.
Parameters:
- idx Flat index in [0, size()).
function findByTime
inline std::optional< size_t > findByTime(
TimeFrameIndex time
) constFind the index of an event by its exact time.
Parameters:
- time The exact TimeFrameIndex to find.
Return: Index of the event, or std::nullopt if not found.
function findByEntityId
inline std::optional< size_t > findByEntityId(
EntityId id
) constFind the index of an event by its EntityId.
Parameters:
- id The EntityId to search for.
Return: Index of the event, or std::nullopt if not found.
function hasEventAtTime
inline bool hasEventAtTime(
TimeFrameIndex time
) constCheck if an event exists at a specific time.
function getTimeRange
inline std::pair< size_t, size_t > getTimeRange(
TimeFrameIndex start,
TimeFrameIndex end
) constGet range of indices for events in [start, end] inclusive.
Parameters:
- start Start time (inclusive).
- end End time (inclusive).
Return: Pair of (start_idx, end_idx) where end is exclusive.
function getTimeDomain
inline DigitalEventTimeDomain getTimeDomain() constGet the time coordinate domain for this storage.
function isRelative
inline bool isRelative() constCheck if events are stored as relative ClockTicks.
function getRelativeEvent
inline ClockTicks getRelativeEvent(
size_t idx
) constGet the relative event time at a flat index.
Parameters:
- idx Flat index in [0, size()).
Precondition: getTimeDomain() == DigitalEventTimeDomain::RelativeClockTicks
function findByRelativeTime
inline std::optional< size_t > findByRelativeTime(
ClockTicks time
) constFind the index of an event by its exact relative time.
Parameters:
- time The exact ClockTicks to find.
Return: Index of the event, or std::nullopt if not found.
function getRelativeTimeRange
inline std::pair< size_t, size_t > getRelativeTimeRange(
ClockTicks start,
ClockTicks end
) constGet range of indices for events in [start, end] inclusive (relative time).
Parameters:
- start Start time (inclusive).
- end End time (inclusive).
Return: Pair of (start_idx, end_idx) where end is exclusive.
function getStorageType
inline DigitalEventStorageType getStorageType() constGet the storage type identifier.
function isView
inline bool isView() constCheck if this is a view (doesn’t own data).
function isLazy
inline bool isLazy() constCheck if this is lazy storage.
function isRelativeOwning
inline bool isRelativeOwning() constCheck if this is relative owning storage.
function tryGetCache
inline DigitalEventStorageCache tryGetCache() constTry to get cached pointers for fast-path access.
Return: DigitalEventStorageCache with valid pointers if contiguous, invalid otherwise.
Protected Functions Documentation
function ~DigitalEventStorageBase
~DigitalEventStorageBase() =defaultUpdated on 2026-11-13 at 20:25:41 +0000