Template Struct TypedColumn

Struct Documentation

template<typename T>
struct TypedColumn

A named column of values of one type, stored row-major.

A plain value type: copying a column copies its data. The mdspan view is built on demand rather than stored, since a stored view would keep pointing at the source’s buffer after a copy.

Template Parameters:

T – A type in h5dispatch::ColumnTypes.

Public Types

using value_type = T

Public Functions

inline TypedColumn(std::string name, std::vector<size_t> shape, storage_type<T> data)

Constructs a column from a shape and matching flat data.

Parameters:
  • name – The name of the column.

  • shape – {rows} or {rows, cols}.

  • data – Flat vector of values in row-major order.

Throws:

std::runtime_error – if the shape is not {N} or {N, M}.

inline size_t rows() const

Number of rows (reflections).

inline size_t cols() const

Values per row; 1 for a column of shape {N}.

inline mdspan_type<T> span()

Returns a rows x cols view over the column data.

inline mdspan_type<const T> span() const

Returns a read-only rows x cols view over the column data.

inline TypedColumn<T> filtered(const std::vector<size_t> &selected_rows) const

Returns a copy of the column keeping only the given rows.

Parameters:

selected_rows – Indices of rows to keep, in output order.

Public Members

std::string name

Name of the dataset.

std::vector<size_t> shape

{rows} or {rows, cols}

storage_type<T> data

Row-major values.