Skip to main content

DenseTimeIndexStorage

DenseTimeIndexStorage

Dense time index storage for consecutive, regularly-sampled data. More…

#include <TimeIndexStorage.hpp>

Inherits from TimeIndexStorage

Public Functions

Name
DenseTimeIndexStorage(TimeFrameIndex start_index, size_t count)
Construct dense storage.
virtual TimeFrameIndex getTimeFrameIndexAt(size_t array_position) const override
Get the TimeFrameIndex at a specific array position.
virtual size_t size() const override
Get the total number of time points stored.
virtual std::optional< size_t > findArrayPositionForTimeIndex(TimeFrameIndex time_index) const override
Find the array position for a specific TimeFrameIndex.
virtual std::optional< size_t > findArrayPositionGreaterOrEqual(TimeFrameIndex target_time) const override
Find array position for the smallest TimeFrameIndex >= target.
virtual std::optional< size_t > findArrayPositionLessOrEqual(TimeFrameIndex target_time) const override
Find array position for the largest TimeFrameIndex <= target.
virtual std::vector< TimeFrameIndex > getAllTimeIndices() const override
Get all time indices as a vector.
virtual std::shared_ptr< TimeIndexStorage > clone() const override
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 override
Create an iterator for a range of array positions.
TimeFrameIndex getStartIndex() const
size_t getCount() const

Additional inherited members

Public Functions inherited from TimeIndexStorage

Name
virtual ~TimeIndexStorage() =default

Detailed Description

class DenseTimeIndexStorage;

Dense time index storage for consecutive, regularly-sampled data.

Memory-efficient representation for time series with consecutive indices: start, start+1, start+2, …, start+count-1

This is ideal for uniformly sampled data where time indices form a continuous sequence.

Public Functions Documentation

function DenseTimeIndexStorage

DenseTimeIndexStorage(
    TimeFrameIndex start_index,
    size_t count
)

Construct dense storage.

Parameters:

  • start_index The first TimeFrameIndex in the sequence
  • count The number of consecutive indices

function getTimeFrameIndexAt

virtual TimeFrameIndex getTimeFrameIndexAt(
    size_t array_position
) const override

Get 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

Reimplements: TimeIndexStorage::getTimeFrameIndexAt

function size

virtual size_t size() const override

Get the total number of time points stored.

Return: The count of time indices

Reimplements: TimeIndexStorage::size

function findArrayPositionForTimeIndex

virtual std::optional< size_t > findArrayPositionForTimeIndex(
    TimeFrameIndex time_index
) const override

Find the array position for a specific TimeFrameIndex.

Parameters:

Return: Optional array position if found, nullopt otherwise

Reimplements: TimeIndexStorage::findArrayPositionForTimeIndex

function findArrayPositionGreaterOrEqual

virtual std::optional< size_t > findArrayPositionGreaterOrEqual(
    TimeFrameIndex target_time
) const override

Find array position for the smallest TimeFrameIndex >= target.

Parameters:

Return: Optional array position, or nullopt if no such index exists

Reimplements: TimeIndexStorage::findArrayPositionGreaterOrEqual

function findArrayPositionLessOrEqual

virtual std::optional< size_t > findArrayPositionLessOrEqual(
    TimeFrameIndex target_time
) const override

Find array position for the largest TimeFrameIndex <= target.

Parameters:

Return: Optional array position, or nullopt if no such index exists

Reimplements: TimeIndexStorage::findArrayPositionLessOrEqual

function getAllTimeIndices

virtual std::vector< TimeFrameIndex > getAllTimeIndices() const override

Get all time indices as a vector.

Return: Vector containing all TimeFrameIndex values

Note: For dense storage, this generates the vector on-demand

Reimplements: TimeIndexStorage::getAllTimeIndices

function clone

virtual std::shared_ptr< TimeIndexStorage > clone() const override

Clone this storage (for copy operations).

Return: A new shared_ptr to a copy of this storage

Reimplements: TimeIndexStorage::clone

function createIterator

virtual std::unique_ptr< TimeIndexIterator > createIterator(
    size_t start_position,
    size_t end_position,
    bool is_end =false
) const override

Create 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

Reimplements: TimeIndexStorage::createIterator

function getStartIndex

inline TimeFrameIndex getStartIndex() const

function getCount

inline size_t getCount() const

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