|
MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
|
On-demand windowing and field operations over an indexed array. More...
#include <DataFieldTraversal.hpp>
Collaboration diagram for MayaFlux::Kakshya::DataFieldTraversal< Array >:Public Member Functions | |
| void | advance (size_t rows=0) |
| Move forward without passing the end of the array. | |
| bool | at_end () const |
| Whether there are no elements after the current position. | |
| size_t | batch_size () const noexcept |
| Current window size. | |
| auto | current () const |
| Borrow the current window, including a short final window. | |
| DataFieldTraversal (const Array &array, size_t batch_size=1) noexcept | |
| Borrow an array and set the initial window size. | |
| template<typename Fn > | |
| void | for_each (Fn &&fn) const |
| Apply a callable to each available element in the array. | |
| template<typename Fn > | |
| void | for_each_in_window (Fn &&fn) const |
| Apply a callable to each available element in the current window. | |
| size_t | position () const noexcept |
| Current zero-based element position. | |
| template<typename Acc , typename Fn > | |
| Acc | reduce (Acc init, Fn &&fn) const |
| Fold all available elements into an accumulator. | |
| size_t | remaining () const |
| Number of elements after the current position. | |
| void | seek (size_t row) |
| Set the position, clamped to the end of the array. | |
| void | set_batch_size (size_t rows) noexcept |
| Set the window size for subsequent operations. | |
| template<typename ValueT > requires requires(const Array& array, std::string_view name) { array.template to_nddata<ValueT>(name); } | |
| auto | to_nddata (std::string_view field_name) const |
| Derive homogeneous NDData from one field across the entire array. | |
| template<typename ValueT > requires requires(const Array& array, std::string_view name) { array.slice(size_t {}, size_t {})->template to_nddata<ValueT>(name); } | |
| auto | window_to_nddata (std::string_view field_name) const |
| Derive homogeneous NDData from one field in the current window. | |
Private Attributes | |
| const Array * | m_array |
| size_t | m_batch_size |
| size_t | m_position {} |
On-demand windowing and field operations over an indexed array.
A traversal maintains an independent position and batch size without owning the array. Field projection is available when the array and its slices provide to_nddata<T>(field_name). The same traversal works with any FieldArray; neither it nor the array needs to name a concrete record format.
Usage:
| Array | Indexed array satisfying FieldArray. |
Definition at line 46 of file DataFieldTraversal.hpp.