Skip to main content

RaggedStorageCache

RaggedStorageCache

Cache structure for fast-path access to contiguous storage. More…

#include <RaggedStorage.hpp>

Public Functions

Name
bool isValid() const
Check if the cache is valid for fast-path access.
TimeFrameIndex getTime(size_t idx) const
TData const & getData(size_t idx) const
EntityId getEntityId(size_t idx) const

Public Attributes

Name
TimeFrameIndex const * times_ptr
TData const * data_ptr
EntityId const * entity_ids_ptr
size_t cache_size
bool is_contiguous
True if storage is contiguous (owning).

Detailed Description

template <typename TData >
struct RaggedStorageCache;

Cache structure for fast-path access to contiguous storage.

Template Parameters:

When storage is contiguous (OwningRaggedStorage), iterators can use cached pointers for zero-overhead access. For non-contiguous storage (ViewRaggedStorage, LazyRaggedStorage), the cache is invalid and iterators fall back to virtual dispatch.

This optimization mirrors the pattern used in AnalogTimeSeries where contiguous storage gets pointer caching for fast iteration.

Public Functions Documentation

function isValid

inline bool isValid() const

Check if the cache is valid for fast-path access.

Return:

  • true if storage is contiguous (can use direct pointer access)
  • false if storage is non-contiguous (must use virtual dispatch)

A valid cache indicates that the underlying storage is contiguous and pointer arithmetic can be used for iteration. Note that an empty owning storage still has a valid cache (is_contiguous=true), it just has cache_size=0.

function getTime

inline TimeFrameIndex getTime(
    size_t idx
) const

function getData

inline TData const & getData(
    size_t idx
) const

function getEntityId

inline EntityId getEntityId(
    size_t idx
) const

Public Attributes Documentation

variable times_ptr

TimeFrameIndex const  * times_ptr = nullptr;

variable data_ptr

TData const  * data_ptr = nullptr;

variable entity_ids_ptr

EntityId const  * entity_ids_ptr = nullptr;

variable cache_size

size_t cache_size = 0;

variable is_contiguous

bool is_contiguous = false;

True if storage is contiguous (owning).


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