Turi Create
4.0
|
#include <core/storage/sframe_data/sarray_iterators.hpp>
Public Member Functions | |
bool | done () const |
bool | read_next (size_t *row_number_start, std::vector< DataType > *read_data) |
Class for fast, sequential iteration through an SArray. Avoids copies and buffering, and the size of each chunk of data is given by a single block.
Example:
auto it = make_sarray_block_iterator(data);
in_parallel([&](size_t thread_idx, size_t num_threads) {
std::vector<T> v; while(true) { size_t row_start; if(it.read_next(&row_start, &v)) { break; } //... // v contains elements row_start + 0, row_start + 1, ..., row_start + (v.size()-1) //... }
});
Definition at line 48 of file sarray_iterators.hpp.
|
inline |
True if we're done.
Definition at line 64 of file sarray_iterators.hpp.
|
inline |
Reads the next block of data, writing the row number of the starting block to row_number_start, and all the data within that block to the vector pointed to by read_data. After this call, read_data contains elements row_number_start + 0, row_number_start + 1, ..., row_number_start + (read_data.size()-1)
Returns true if all data has been read. In this case, row_number_start is set to the number of elements in the sarray. Otherwise, returns false.
Definition at line 79 of file sarray_iterators.hpp.