TimeIndexStorage
TimeIndexStorage
Abstract base class for time index storage strategies. More…
#include <TimeIndexStorage.hpp>
Inherited by DenseTimeIndexStorage, SparseTimeIndexStorage
Public Functions
| Name | |
|---|---|
| virtual | ~TimeIndexStorage() =default |
| virtual TimeFrameIndex | getTimeFrameIndexAt(size_t array_position) const =0 Get the TimeFrameIndex at a specific array position. |
| virtual size_t | size() const =0 Get the total number of time points stored. |
| virtual std::optional< size_t > | findArrayPositionForTimeIndex(TimeFrameIndex time_index) const =0 Find the array position for a specific TimeFrameIndex. |
| virtual std::optional< size_t > | findArrayPositionGreaterOrEqual(TimeFrameIndex target_time) const =0 Find array position for the smallest TimeFrameIndex >= target. |
| virtual std::optional< size_t > | findArrayPositionLessOrEqual(TimeFrameIndex target_time) const =0 Find array position for the largest TimeFrameIndex <= target. |
| virtual std::vector< TimeFrameIndex > | getAllTimeIndices() const =0 Get all time indices as a vector. |
| virtual std::shared_ptr< TimeIndexStorage > | clone() const =0 Clone this storage (for copy operations). |
| virtual std::unique_ptr< TimeIndexIterator > | createIterator(size_t start_position, size_t end_position, bool is_end =false) const =0 Create an iterator for a range of array positions. |
Detailed Description
class TimeIndexStorage;Abstract base class for time index storage strategies.
TimeIndexStorage provides a mapping from logical array positions (0, 1, 2, …) to TimeFrameIndex values. Different implementations can optimize storage based on data characteristics (dense/consecutive vs sparse/irregular sampling).
This abstraction allows multiple data series to share the same time base (e.g., multi-channel electrophysiology recordings) and supports future extensions like memory-mapped or calculated time indices.
Public Functions Documentation
function ~TimeIndexStorage
virtual ~TimeIndexStorage() =defaultfunction getTimeFrameIndexAt
virtual TimeFrameIndex getTimeFrameIndexAt(
size_t array_position
) const =0Get the TimeFrameIndex at a specific array position.
Parameters:
- array_position The logical position in the data array (0-based)
Exceptions:
- std::out_of_range if array_position is out of bounds
Return: The TimeFrameIndex corresponding to that position
Reimplemented by: DenseTimeIndexStorage::getTimeFrameIndexAt, SparseTimeIndexStorage::getTimeFrameIndexAt
function size
virtual size_t size() const =0Get the total number of time points stored.
Return: The count of time indices
Reimplemented by: DenseTimeIndexStorage::size, SparseTimeIndexStorage::size
function findArrayPositionForTimeIndex
virtual std::optional< size_t > findArrayPositionForTimeIndex(
TimeFrameIndex time_index
) const =0Find the array position for a specific TimeFrameIndex.
Parameters:
- time_index The TimeFrameIndex to search for
Return: Optional array position if found, nullopt otherwise
Reimplemented by: DenseTimeIndexStorage::findArrayPositionForTimeIndex, SparseTimeIndexStorage::findArrayPositionForTimeIndex
function findArrayPositionGreaterOrEqual
virtual std::optional< size_t > findArrayPositionGreaterOrEqual(
TimeFrameIndex target_time
) const =0Find array position for the smallest TimeFrameIndex >= target.
Parameters:
- target_time The target TimeFrameIndex
Return: Optional array position, or nullopt if no such index exists
Reimplemented by: DenseTimeIndexStorage::findArrayPositionGreaterOrEqual, SparseTimeIndexStorage::findArrayPositionGreaterOrEqual
function findArrayPositionLessOrEqual
virtual std::optional< size_t > findArrayPositionLessOrEqual(
TimeFrameIndex target_time
) const =0Find array position for the largest TimeFrameIndex <= target.
Parameters:
- target_time The target TimeFrameIndex
Return: Optional array position, or nullopt if no such index exists
Reimplemented by: DenseTimeIndexStorage::findArrayPositionLessOrEqual, SparseTimeIndexStorage::findArrayPositionLessOrEqual
function getAllTimeIndices
virtual std::vector< TimeFrameIndex > getAllTimeIndices() const =0Get all time indices as a vector.
Return: Vector containing all TimeFrameIndex values
Note: For dense storage, this generates the vector on-demand
Reimplemented by: DenseTimeIndexStorage::getAllTimeIndices, SparseTimeIndexStorage::getAllTimeIndices
function clone
virtual std::shared_ptr< TimeIndexStorage > clone() const =0Clone this storage (for copy operations).
Return: A new shared_ptr to a copy of this storage
Reimplemented by: DenseTimeIndexStorage::clone, SparseTimeIndexStorage::clone
function createIterator
virtual std::unique_ptr< TimeIndexIterator > createIterator(
size_t start_position,
size_t end_position,
bool is_end =false
) const =0Create an iterator for a range of array positions.
Parameters:
- start_position The starting array position (inclusive)
- end_position The ending array position (exclusive)
- is_end Whether to create an end iterator
Return: A unique_ptr to a TimeIndexIterator
Reimplemented by: DenseTimeIndexStorage::createIterator, SparseTimeIndexStorage::createIterator
Updated on 2026-11-13 at 20:25:39 +0000