Skip to main content

AnalogDataStorageBase

AnalogDataStorageBase

CRTP base class for analog data storage implementations. More…

#include <AnalogDataStorageBase.hpp>

Public Functions

Name
std::size_t size() const
Get the number of samples in storage.
bool empty() const
Check if storage is empty.
float getValueAt(std::size_t index) const
Get the value at a specific index.
std::span< float const > getSpan() const
Get a span over all data (if contiguous).
std::span< float const > getSpanRange(std::size_t start, std::size_t end) const
Get a span over a sub-range of data (if contiguous).
bool isContiguous() const
Check if data is stored contiguously in memory.
AnalogStorageType getStorageType() const
Get the storage type identifier.
bool isView() const
Check if this storage is a view (non-owning).
bool isLazy() const
Check if this storage is lazy-evaluated.
AnalogDataStorageCache tryGetCache() const
Try to get a cache for fast-path contiguous access.

Protected Functions

Name
~AnalogDataStorageBase() =default

Detailed Description

template <typename Derived >
class AnalogDataStorageBase;

CRTP base class for analog data storage implementations.

Template Parameters:

  • Derived The concrete storage implementation type.

Uses the Curiously Recurring Template Pattern to eliminate virtual function overhead while still providing a uniform interface that higher-level code (such as the type-erased wrapper) can rely on.

Public Functions Documentation

function size

inline std::size_t size() const

Get the number of samples in storage.

function empty

inline bool empty() const

Check if storage is empty.

function getValueAt

inline float getValueAt(
    std::size_t index
) const

Get the value at a specific index.

Parameters:

  • index Index into [0, size()).

Return: float value at the given index.

function getSpan

inline std::span< float const > getSpan() const

Get a span over all data (if contiguous).

Returns a non-empty span only if the underlying storage is truly contiguous in memory. Non-contiguous storage returns an empty span.

function getSpanRange

inline std::span< float const > getSpanRange(
    std::size_t start,
    std::size_t end
) const

Get a span over a sub-range of data (if contiguous).

Parameters:

  • start Starting index (inclusive).
  • end Ending index (exclusive).

Return: std::span over the requested range, or empty span if storage is not contiguous.

function isContiguous

inline bool isContiguous() const

Check if data is stored contiguously in memory.

function getStorageType

inline AnalogStorageType getStorageType() const

Get the storage type identifier.

function isView

inline bool isView() const

Check if this storage is a view (non-owning).

function isLazy

inline bool isLazy() const

Check if this storage is lazy-evaluated.

function tryGetCache

inline AnalogDataStorageCache tryGetCache() const

Try to get a cache for fast-path contiguous access.

Return: AnalogDataStorageCache with valid pointer if storage is contiguous, invalid cache otherwise.

Protected Functions Documentation

function ~AnalogDataStorageBase

~AnalogDataStorageBase() =default

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