iris::Data 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.
The entries a read produces, in definition order (Specification §3.1). More...
#include <iris/data.hpp>
Public Member Functions | |
| Data () | |
| Data without entries, which allocates nothing. | |
| std::size_t | size () const |
| Return the number of entries. | |
| std::string_view | name (std::size_t i) const |
| Return the name of entry i. | |
| ValueRef | value (std::size_t i) const |
| Return the value of entry i. | |
| std::optional< ValueRef > | find (std::string_view name) const |
| Return the value of the entry called name, or nothing if there is none. | |
| std::pmr::string | dzn () const |
| Return the entries as a MiniZinc data file (Specification appendix B): one assignment per entry, each ending with a newline, or nothing without entries. | |
| ValueRef | at (std::string_view name, std::span< const std::size_t > path={}) const |
| Return the part of entry name that path selects. | |
| std::size_t | size (std::string_view name, std::span< const std::size_t > path={}) const |
| Return the number of elements of the array that path selects. | |
| std::int64_t | integer (std::string_view name, std::span< const std::size_t > path={}) const |
| Return the single integer that path selects. | |
| double | number (std::string_view name, std::span< const std::size_t > path={}) const |
| Return the single number that path selects, converting an integer to a float. | |
| std::string_view | text (std::string_view name, std::span< const std::size_t > path={}) const |
| Return the single string that path selects. | |
| std::span< const std::int64_t > | ints (std::string_view name, std::span< const std::size_t > path={}) const |
| Return the integers of the one-dimensional array that path selects. | |
| std::span< const double > | floats (std::string_view name, std::span< const std::size_t > path={}) const |
| Return the floats of the one-dimensional array that path selects. | |
| template<class Handle> | |
| auto | get (const Handle &handle) const -> decltype(handle.view(*this)) |
| Return the entry that handle names, typed by the handle: for an iris::Field, the iris::View of its value type, depth and presence. | |
| ValueRef | at (std::string_view name, std::initializer_list< std::size_t > path) const |
| The same as at() with a braced path, as in data.at("clause", {3}). | |
| std::size_t | size (std::string_view name, std::initializer_list< std::size_t > path) const |
| The same as size() with a braced path. | |
| std::int64_t | integer (std::string_view name, std::initializer_list< std::size_t > path) const |
| The same as integer() with a braced path. | |
| double | number (std::string_view name, std::initializer_list< std::size_t > path) const |
| The same as number() with a braced path. | |
| std::string_view | text (std::string_view name, std::initializer_list< std::size_t > path) const |
| The same as text() with a braced path. | |
| std::span< const std::int64_t > | ints (std::string_view name, std::initializer_list< std::size_t > path) const |
| The same as ints() with a braced path, as in data.ints("clause", {3}). | |
| std::span< const double > | floats (std::string_view name, std::initializer_list< std::size_t > path) const |
| The same as floats() with a braced path. | |
Detailed Description
The entries a read produces, in definition order (Specification §3.1).
Copies share the entries, which never change, so they are cheap. The entries use the memory of the spec that read them (see Spec). The accessors that take a name and a path return the part of the named entry that the path selects; misuse throws AccessError.
Constructor & Destructor Documentation
Data()
| iris::Data::Data | ( | ) |
Data without entries, which allocates nothing.
Member Function Documentation
at() [1/2]
|
inlinenodiscard |
The same as at() with a braced path, as in data.at("clause", {3}).
at() [2/2]
|
nodiscard |
Return the part of entry name that path selects.
dzn()
|
nodiscard |
Return the entries as a MiniZinc data file (Specification appendix B): one assignment per entry, each ending with a newline, or nothing without entries.
The text is allocated from the memory resource of the spec that read the data.
find()
|
nodiscard |
Return the value of the entry called name, or nothing if there is none.
floats() [1/2]
|
inlinenodiscard |
The same as floats() with a braced path.
floats() [2/2]
|
nodiscard |
Return the floats of the one-dimensional array that path selects.
get()
|
inlinenodiscard |
Return the entry that handle names, typed by the handle: for an iris::Field, the iris::View of its value type, depth and presence.
Throws AccessError if a required entry is missing, or if the entry has another type or depth than the handle promises.
integer() [1/2]
|
inlinenodiscard |
The same as integer() with a braced path.
integer() [2/2]
|
nodiscard |
Return the single integer that path selects.
ints() [1/2]
|
inlinenodiscard |
The same as ints() with a braced path, as in data.ints("clause", {3}).
ints() [2/2]
|
nodiscard |
Return the integers of the one-dimensional array that path selects.
name()
|
nodiscard |
Return the name of entry i.
number() [1/2]
|
inlinenodiscard |
The same as number() with a braced path.
number() [2/2]
|
nodiscard |
Return the single number that path selects, converting an integer to a float.
size() [1/3]
|
nodiscard |
Return the number of entries.
size() [2/3]
|
inlinenodiscard |
The same as size() with a braced path.
size() [3/3]
|
nodiscard |
Return the number of elements of the array that path selects.
text() [1/2]
|
inlinenodiscard |
The same as text() with a braced path.
text() [2/2]
|
nodiscard |
Return the single string that path selects.
value()
|
nodiscard |
Return the value of entry i.