Skip to main content

RelativeOwningDigitalEventStorage

RelativeOwningDigitalEventStorage

Immutable owning storage for trial-relative digital event times. More…

#include <RelativeOwningDigitalEventStorage.hpp>

Inherits from DigitalEventStorageBase< RelativeOwningDigitalEventStorage >

Public Functions

Name
RelativeOwningDigitalEventStorage(std::vector< ClockTicks > events)
Construct from existing relative event vector (will sort and deduplicate).
RelativeOwningDigitalEventStorage(std::vector< ClockTicks > events, std::vector< EntityId > entity_ids)
Construct from existing relative event and entity ID vectors.
size_t sizeImpl() const
EntityId getEntityIdImpl(size_t idx) const
std::optional< size_t > findByEntityIdImpl(EntityId id) const
DigitalEventTimeDomain getTimeDomainImpl() const
ClockTicks getRelativeEventImpl(size_t idx) const
std::optional< size_t > findByRelativeTimeImpl(ClockTicks time) const
std::pair< size_t, size_t > getRelativeTimeRangeImpl(ClockTicks start, ClockTicks end) const
DigitalEventStorageType getStorageTypeImpl() const
DigitalEventStorageCache tryGetCacheImpl() const
Get cache with pointers to contiguous relative event data.
std::vector< ClockTicks > const & events() const
std::vector< EntityId > const & entityIds() const
std::span< ClockTicks const > eventsSpan() const
std::span< EntityId const > entityIdsSpan() const
TimeFrameIndex getEventImpl(size_t idx)
std::optional< size_t > findByTimeImpl(TimeFrameIndex time)
std::pair< size_t, size_t > getTimeRangeImpl(TimeFrameIndex start, TimeFrameIndex end)

Additional inherited members

Public Functions inherited from DigitalEventStorageBase< RelativeOwningDigitalEventStorage >

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 inherited from DigitalEventStorageBase< RelativeOwningDigitalEventStorage >

Name
~DigitalEventStorageBase() =default

Detailed Description

class RelativeOwningDigitalEventStorage;

Immutable owning storage for trial-relative digital event times.

Stores event data in parallel vectors for cache-friendly access:

  • _events[i] - relative ClockTicks for event i (sorted)
  • _entity_ids[i] - EntityId for event i

Constructed once from caller-provided vectors; no mutation API is provided. Does not require an associated TimeFrame.

Public Functions Documentation

function RelativeOwningDigitalEventStorage

explicit RelativeOwningDigitalEventStorage(
    std::vector< ClockTicks > events
)

Construct from existing relative event vector (will sort and deduplicate).

Parameters:

  • events Relative event times (sorted and deduplicated in place).

function RelativeOwningDigitalEventStorage

RelativeOwningDigitalEventStorage(
    std::vector< ClockTicks > events,
    std::vector< EntityId > entity_ids
)

Construct from existing relative event and entity ID vectors.

Parameters:

  • events Relative event times (sorted and deduplicated in place).
  • entity_ids Entity IDs aligned with events before sorting.

Precondition: events.size() == entity_ids.size()

function sizeImpl

inline size_t sizeImpl() const

function getEntityIdImpl

inline EntityId getEntityIdImpl(
    size_t idx
) const

function findByEntityIdImpl

std::optional< size_t > findByEntityIdImpl(
    EntityId id
) const

function getTimeDomainImpl

inline DigitalEventTimeDomain getTimeDomainImpl() const

function getRelativeEventImpl

inline ClockTicks getRelativeEventImpl(
    size_t idx
) const

function findByRelativeTimeImpl

std::optional< size_t > findByRelativeTimeImpl(
    ClockTicks time
) const

function getRelativeTimeRangeImpl

std::pair< size_t, size_t > getRelativeTimeRangeImpl(
    ClockTicks start,
    ClockTicks end
) const

function getStorageTypeImpl

inline DigitalEventStorageType getStorageTypeImpl() const

function tryGetCacheImpl

inline DigitalEventStorageCache tryGetCacheImpl() const

Get cache with pointers to contiguous relative event data.

function events

inline std::vector< ClockTicks > const & events() const

function entityIds

inline std::vector< EntityId > const & entityIds() const

function eventsSpan

inline std::span< ClockTicks const > eventsSpan() const

function entityIdsSpan

inline std::span< EntityId const > entityIdsSpan() const

function getEventImpl

static TimeFrameIndex getEventImpl(
    size_t idx
)

function findByTimeImpl

static std::optional< size_t > findByTimeImpl(
    TimeFrameIndex time
)

function getTimeRangeImpl

static std::pair< size_t, size_t > getTimeRangeImpl(
    TimeFrameIndex start,
    TimeFrameIndex end
)

Updated on 2026-11-13 at 20:25:40 +0000