Skip to main content

ViewDigitalIntervalStorage

ViewDigitalIntervalStorage

View-based digital interval storage that references another storage. More…

#include <ViewDigitalIntervalStorage.hpp>

Inherits from DigitalIntervalStorageBase< ViewDigitalIntervalStorage >

Public Functions

Name
ViewDigitalIntervalStorage(std::shared_ptr< OwningDigitalIntervalStorage const > source)
Construct a view referencing source storage.
void setIndices(std::vector< size_t > indices)
Set the indices this view includes.
void setAllIndices()
Create view of all intervals.
void filterByOverlappingRange(TimeFrameIndex start, TimeFrameIndex end)
Filter by overlapping time range [start, end].
void filterByOverlappingRangeLinear(TimeFrameIndex start, TimeFrameIndex end)
Filter by overlapping time range [start, end] using linear scan.
void filterByContainedRange(TimeFrameIndex start, TimeFrameIndex end)
Filter by contained time range [start, end].
void filterByEntityIds(std::unordered_set< EntityId > const & ids)
Filter by EntityId set.
std::shared_ptr< OwningDigitalIntervalStorage const > source() const
Get the source storage.
std::vector< size_t > const & indices() const
Get the indices vector.
size_t sizeImpl() const
TimeFrameInterval const & getIntervalImpl(size_t idx) const
EntityId getEntityIdImpl(size_t idx) const
std::optional< size_t > findByIntervalImpl(TimeFrameInterval const & interval) const
std::optional< size_t > findByEntityIdImpl(EntityId id) const
bool hasIntervalAtTimeImpl(TimeFrameIndex time) const
std::pair< size_t, size_t > getOverlappingRangeImpl(TimeFrameIndex start, TimeFrameIndex end) const
Get index range of view-local indices overlapping [start, end].
std::pair< size_t, size_t > getContainedRangeImpl(TimeFrameIndex start, TimeFrameIndex end) const
DigitalIntervalStorageType getStorageTypeImpl() const
DigitalIntervalStorageCache tryGetCacheImpl() const
Return cache if view is contiguous.

Additional inherited members

Public Functions inherited from DigitalIntervalStorageBase< ViewDigitalIntervalStorage >

Name
size_t size() const
Get total number of intervals.
bool empty() const
Check if storage is empty.
TimeFrameInterval const & getInterval(size_t idx) const
Get the interval at a flat index.
EntityId getEntityId(size_t idx) const
Get the EntityId at a flat index.
std::optional< size_t > findByInterval(TimeFrameInterval const & interval) const
Find the index of an interval by its exact start/end times.
std::optional< size_t > findByEntityId(EntityId id) const
Find the index of an interval by its EntityId.
bool hasIntervalAtTime(TimeFrameIndex time) const
Check if any interval contains the specified time.
std::pair< size_t, size_t > getOverlappingRange(TimeFrameIndex start, TimeFrameIndex end) const
Get range of indices for intervals overlapping [start, end].
std::pair< size_t, size_t > getContainedRange(TimeFrameIndex start, TimeFrameIndex end) const
Get range of indices for intervals fully contained in [start, end].
DigitalIntervalStorageType 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.
DigitalIntervalStorageCache tryGetCache() const
Try to get cached pointers for fast-path access.

Protected Functions inherited from DigitalIntervalStorageBase< ViewDigitalIntervalStorage >

Name
~DigitalIntervalStorageBase() =default

Detailed Description

class ViewDigitalIntervalStorage;

View-based digital interval storage that references another storage.

Holds a shared_ptr to a source OwningDigitalIntervalStorage and a vector of indices into that source. Enables zero-copy filtered views.

Public Functions Documentation

function ViewDigitalIntervalStorage

explicit ViewDigitalIntervalStorage(
    std::shared_ptr< OwningDigitalIntervalStorage const > source
)

Construct a view referencing source storage.

Parameters:

  • source Shared pointer to source storage

function setIndices

void setIndices(
    std::vector< size_t > indices
)

Set the indices this view includes.

function setAllIndices

void setAllIndices()

Create view of all intervals.

function filterByOverlappingRange

void filterByOverlappingRange(
    TimeFrameIndex start,
    TimeFrameIndex end
)

Filter by overlapping time range [start, end].

See:

Delegates to the source owning storage when [source()](/api_generated/Classes/classViewDigitalIntervalStorage.md#function-source)->assumeDisjointIntervals() is true (O(log n) on source size), otherwise uses filterByOverlappingRangeLinear().

function filterByOverlappingRangeLinear

void filterByOverlappingRangeLinear(
    TimeFrameIndex start,
    TimeFrameIndex end
)

Filter by overlapping time range [start, end] using linear scan.

See:

O(n) over source intervals; correct when intervals may overlap. Same overlap test as OwningDigitalIntervalStorage::getOverlappingRangeImpl() in overlapping mode and LazyDigitalIntervalStorage::getOverlappingRangeImpl().

function filterByContainedRange

void filterByContainedRange(
    TimeFrameIndex start,
    TimeFrameIndex end
)

Filter by contained time range [start, end].

function filterByEntityIds

void filterByEntityIds(
    std::unordered_set< EntityId > const & ids
)

Filter by EntityId set.

function source

std::shared_ptr< OwningDigitalIntervalStorage const > source() const

Get the source storage.

function indices

inline std::vector< size_t > const & indices() const

Get the indices vector.

function sizeImpl

inline size_t sizeImpl() const

function getIntervalImpl

TimeFrameInterval const & getIntervalImpl(
    size_t idx
) const

function getEntityIdImpl

EntityId getEntityIdImpl(
    size_t idx
) const

function findByIntervalImpl

std::optional< size_t > findByIntervalImpl(
    TimeFrameInterval const & interval
) const

function findByEntityIdImpl

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

function hasIntervalAtTimeImpl

bool hasIntervalAtTimeImpl(
    TimeFrameIndex time
) const

function getOverlappingRangeImpl

std::pair< size_t, size_t > getOverlappingRangeImpl(
    TimeFrameIndex start,
    TimeFrameIndex end
) const

Get index range of view-local indices overlapping [start, end].

See:

Disjoint fast path ([source()](/api_generated/Classes/classViewDigitalIntervalStorage.md#function-source)->assumeDisjointIntervals() == true): O(log n) binary search over view indices (requires disjoint source intervals).

Overlapping fallback: O(n) linear scan over view indices.

function getContainedRangeImpl

std::pair< size_t, size_t > getContainedRangeImpl(
    TimeFrameIndex start,
    TimeFrameIndex end
) const

function getStorageTypeImpl

inline DigitalIntervalStorageType getStorageTypeImpl() const

function tryGetCacheImpl

DigitalIntervalStorageCache tryGetCacheImpl() const

Return cache if view is contiguous.


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