Skip to content

iris::ValueRef Class Reference

Doxygen 1.15.0 generates this reference during each site build from the public headers. The C++ guide shows the API in use.

A borrowed view of a value read, or of the part of it that a path selects. More...

#include <iris/data.hpp>

Public Member Functions

ValueType type () const
 Return the type of the leaves.
std::size_t depth () const
 Return the number of array levels, 0 for a single value.
std::size_t size () const
 Return the number of elements of this array.
ValueRef operator[] (std::size_t i) const
 Return element i of this array, counted from 0.
ValueRef at (std::span< const std::size_t > path) const
 Return the part that path selects, one index per level.
ValueRef at (std::initializer_list< std::size_t > path) const
 Return the part that the braced path selects, as in at({1, 0}).
std::int64_t integer () const
 Return this single integer.
double number () const
 Return this single number, converting an integer to a float.
std::string_view text () const
 Return this single string.
std::span< const std::int64_t > ints () const
 Return the integers of this one-dimensional array of integers.
std::span< const double > floats () const
 Return the floats of this one-dimensional array of floats.

Detailed Description

A borrowed view of a value read, or of the part of it that a path selects.

A view of depth 0 is a single value, and a view of depth d > 0 is an array whose elements are views of depth d - 1. The view stays valid while any copy of the Data it comes from exists. Misuse throws AccessError.

Member Function Documentation

at() [1/2]

ValueRef iris::ValueRef::at ( std::initializer_list< std::size_t > path) const
inlinenodiscard

Return the part that the braced path selects, as in at({1, 0}).

at() [2/2]

ValueRef iris::ValueRef::at ( std::span< const std::size_t > path) const
nodiscard

Return the part that path selects, one index per level.

depth()

std::size_t iris::ValueRef::depth ( ) const
nodiscard

Return the number of array levels, 0 for a single value.

floats()

std::span< const double > iris::ValueRef::floats ( ) const
nodiscard

Return the floats of this one-dimensional array of floats.

integer()

std::int64_t iris::ValueRef::integer ( ) const
nodiscard

Return this single integer.

ints()

std::span< const std::int64_t > iris::ValueRef::ints ( ) const
nodiscard

Return the integers of this one-dimensional array of integers.

number()

double iris::ValueRef::number ( ) const
nodiscard

Return this single number, converting an integer to a float.

operator[]()

ValueRef iris::ValueRef::operator[] ( std::size_t i) const
nodiscard

Return element i of this array, counted from 0.

size()

std::size_t iris::ValueRef::size ( ) const
nodiscard

Return the number of elements of this array.

text()

std::string_view iris::ValueRef::text ( ) const
nodiscard

Return this single string.

type()

ValueType iris::ValueRef::type ( ) const
nodiscard

Return the type of the leaves.