Skip to main content

RowDescriptor

RowDescriptor

Describes the row structure of a tensor. More…

#include <RowDescriptor.hpp>

Public Types

Name
using std::variant< std::monostate, std::size_t, TimeFrameIndex, TimeFrameInterval > RowLabel
Label type for a single row — used for display / export.

Public Functions

Name
RowDescriptor ordinal(std::size_t count)
Create an ordinal row descriptor (no temporal meaning).
RowDescriptor fromTimeIndices(std::shared_ptr< TimeIndexStorage > storage, std::shared_ptr< TimeFrame > time_frame)
Create a time-indexed row descriptor.
RowDescriptor fromIntervals(std::vector< TimeFrameInterval > intervals, std::shared_ptr< TimeFrame > time_frame)
Create an interval-based row descriptor.
RowType type() const
Get the row type.
std::size_t count() const
Number of rows.
TimeIndexStorage const & timeStorage() const
Access the TimeIndexStorage (only valid for TimeFrameIndex rows).
std::shared_ptr< TimeIndexStorage > timeStoragePtr() const
Access the shared TimeIndexStorage pointer.
std::span< TimeFrameInterval const > intervals() const
Access the intervals (only valid for Interval rows).
std::shared_ptr< TimeFrame > timeFrame() const
Access the TimeFrame (nullptr for Ordinal rows).
RowLabel labelAt(std::size_t row) const
Get a label for a specific row.
void setOrdinalCount(std::size_t new_count)
Set the ordinal row count.
void appendInterval(TimeFrameInterval interval)
Append an interval to the end.
void insertInterval(std::size_t index, TimeFrameInterval interval)
Insert an interval at a specific position.
bool operator==(RowDescriptor const & other) const
bool operator!=(RowDescriptor const & other) const

Detailed Description

class RowDescriptor;

Describes the row structure of a tensor.

This is a value-type that captures what the “rows” of a tensor mean. It holds either ordinal row count, time index storage, or interval data.

Consumers query [type()](/api_generated/Classes/classRowDescriptor.md#function-type) and then access the appropriate data:

switch (rows.type()) {
    case RowType::TimeFrameIndex:
        // Use rows.timeStorage() and rows.timeFrame()
        break;
    case RowType::Interval:
        // Use rows.intervals() and rows.timeFrame()
        break;
    case RowType::Ordinal:
        // Just use rows.count() for 0..N-1
        break;
}

Public Types Documentation

using RowLabel

using RowDescriptor::RowLabel =  std::variant<std::monostate, std::size_t, TimeFrameIndex, TimeFrameInterval>;

Label type for a single row — used for display / export.

Public Functions Documentation

function ordinal

static RowDescriptor ordinal(
    std::size_t count
)

Create an ordinal row descriptor (no temporal meaning).

Parameters:

  • count Number of rows

Note: No preconditions — all std::size_t values are valid, including zero. Zero is used as a sentinel/empty-state (e.g., before data is loaded). Contrast with [setOrdinalCount()](/api_generated/Classes/classRowDescriptor.md#function-setordinalcount), which rejects zero.

function fromTimeIndices

static RowDescriptor fromTimeIndices(
    std::shared_ptr< TimeIndexStorage > storage,
    std::shared_ptr< TimeFrame > time_frame
)

Create a time-indexed row descriptor.

Parameters:

Exceptions:

  • std::invalid_argument if storage is null

Precondition: storage != nullptr (enforcement: exception)

function fromIntervals

static RowDescriptor fromIntervals(
    std::vector< TimeFrameInterval > intervals,
    std::shared_ptr< TimeFrame > time_frame
)

Create an interval-based row descriptor.

Parameters:

function type

inline RowType type() const

Get the row type.

function count

std::size_t count() const

Number of rows.

function timeStorage

TimeIndexStorage const & timeStorage() const

Access the TimeIndexStorage (only valid for TimeFrameIndex rows).

Exceptions:

function timeStoragePtr

std::shared_ptr< TimeIndexStorage > timeStoragePtr() const

Access the shared TimeIndexStorage pointer.

Exceptions:

function intervals

std::span< TimeFrameInterval const > intervals() const

Access the intervals (only valid for Interval rows).

Exceptions:

function timeFrame

std::shared_ptr< TimeFrame > timeFrame() const

Access the TimeFrame (nullptr for Ordinal rows).

function labelAt

RowLabel labelAt(
    std::size_t row
) const

Get a label for a specific row.

Parameters:

  • row Row index (0-based)

Exceptions:

  • std::out_of_range if row >= count()

Returns:

  • std::size_t for Ordinal rows (the row index)
  • [TimeFrameIndex](/api_generated/Classes/structTimeFrameIndex.md) for TimeFrameIndex rows
  • [TimeFrameInterval](/api_generated/Files/interval__data_8hpp.md#using-timeframeinterval) for Interval rows

function setOrdinalCount

void setOrdinalCount(
    std::size_t new_count
)

Set the ordinal row count.

Parameters:

  • new_count The new row count (must be > 0)

Exceptions:

Only valid for Ordinal rows.

function appendInterval

void appendInterval(
    TimeFrameInterval interval
)

Append an interval to the end.

Parameters:

  • interval The interval for the new row

Exceptions:

Only valid for Interval rows.

function insertInterval

void insertInterval(
    std::size_t index,
    TimeFrameInterval interval
)

Insert an interval at a specific position.

Parameters:

  • index Position to insert before (0-based; count() inserts at end)
  • interval The interval for the new row

Exceptions:

Only valid for Interval rows. Existing intervals at and after the insertion point are shifted.

function operator==

bool operator==(
    RowDescriptor const & other
) const

function operator!=

inline bool operator!=(
    RowDescriptor const & other
) const

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