DigitalIntervalStorageBase
DigitalIntervalStorageBase
CRTP base class for digital interval storage implementations. More…
#include <DigitalIntervalStorageBase.hpp>
Public Functions
| 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
| Name | |
|---|---|
| ~DigitalIntervalStorageBase() =default |
Detailed Description
template <typename Derived >
class DigitalIntervalStorageBase;CRTP base class for digital interval storage implementations.
Template Parameters:
- Derived The concrete storage implementation type
Uses Curiously Recurring Template Pattern to eliminate virtual function overhead while maintaining a polymorphic interface. Intervals are stored as Interval values (representing start/end times) with associated EntityIds.
The SoA (Structure of Arrays) layout stores parallel vectors:
Public Functions Documentation
function size
inline size_t size() constGet total number of intervals.
function empty
inline bool empty() constCheck if storage is empty.
function getInterval
inline TimeFrameInterval const & getInterval(
size_t idx
) constGet the interval 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 findByInterval
inline std::optional< size_t > findByInterval(
TimeFrameInterval const & interval
) constFind the index of an interval by its exact start/end times.
Parameters:
- interval The exact TimeFrameInterval to find
Return: Index of the interval, or std::nullopt if not found
function findByEntityId
inline std::optional< size_t > findByEntityId(
EntityId id
) constFind the index of an interval by its EntityId.
Parameters:
- id The EntityId to search for
Return: Index of the interval, or std::nullopt if not found
function hasIntervalAtTime
inline bool hasIntervalAtTime(
TimeFrameIndex time
) constCheck if any interval contains the specified time.
Parameters:
- time The time to check
Return: true if any interval contains the time
function getOverlappingRange
inline std::pair< size_t, size_t > getOverlappingRange(
TimeFrameIndex start,
TimeFrameIndex end
) constGet range of indices for intervals overlapping [start, end].
Parameters:
- start Start time (inclusive)
- end End time (inclusive)
Return: Pair of (start_idx, end_idx) where end is exclusive
Note: Returns intervals where interval.start <= end && interval.end >= start. Implementation strategy depends on storage backend; see OwningDigitalIntervalStorage::getOverlappingRangeImpl(), ViewDigitalIntervalStorage::getOverlappingRangeImpl(), and LazyDigitalIntervalStorage::getOverlappingRangeImpl().
function getContainedRange
inline std::pair< size_t, size_t > getContainedRange(
TimeFrameIndex start,
TimeFrameIndex end
) constGet range of indices for intervals fully contained in [start, end].
Parameters:
- start Start time (inclusive)
- end End time (inclusive)
Return: Pair of (start_idx, end_idx) where end is exclusive
Note: Returns intervals where interval.start >= start && interval.end <= end
function getStorageType
inline DigitalIntervalStorageType 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 tryGetCache
inline DigitalIntervalStorageCache tryGetCache() constTry to get cached pointers for fast-path access.
Return: DigitalIntervalStorageCache with valid pointers if contiguous, invalid otherwise
Protected Functions Documentation
function ~DigitalIntervalStorageBase
~DigitalIntervalStorageBase() =defaultUpdated on 2026-11-13 at 20:25:41 +0000