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:
- filterByOverlappingRangeLinear()
- OwningDigitalIntervalStorage::getOverlappingRangeImpl()
- LazyDigitalIntervalStorage::getOverlappingRangeImpl()
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() constGet the source storage.
function indices
inline std::vector< size_t > const & indices() constGet the indices vector.
function sizeImpl
inline size_t sizeImpl() constfunction getIntervalImpl
TimeFrameInterval const & getIntervalImpl(
size_t idx
) constfunction getEntityIdImpl
EntityId getEntityIdImpl(
size_t idx
) constfunction findByIntervalImpl
std::optional< size_t > findByIntervalImpl(
TimeFrameInterval const & interval
) constfunction findByEntityIdImpl
std::optional< size_t > findByEntityIdImpl(
EntityId id
) constfunction hasIntervalAtTimeImpl
bool hasIntervalAtTimeImpl(
TimeFrameIndex time
) constfunction getOverlappingRangeImpl
std::pair< size_t, size_t > getOverlappingRangeImpl(
TimeFrameIndex start,
TimeFrameIndex end
) constGet index range of view-local indices overlapping [start, end].
See:
- filterByOverlappingRange()
- OwningDigitalIntervalStorage::getOverlappingRangeImpl()
- LazyDigitalIntervalStorage::getOverlappingRangeImpl()
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
) constfunction getStorageTypeImpl
inline DigitalIntervalStorageType getStorageTypeImpl() constfunction tryGetCacheImpl
DigitalIntervalStorageCache tryGetCacheImpl() constReturn cache if view is contiguous.
Updated on 2026-11-13 at 20:25:39 +0000