MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ read_next()

std::optional< Kakshya::CompositeArray > MayaFlux::IO::XmlReader::read_next ( size_t max_elements)
nodiscardoverridevirtual

Copy at most max_elements rows and advance the position.

Returns
An empty array at end of document, or nullopt on failure.

Implements MayaFlux::IO::CompositeReader.

Definition at line 258 of file XmlReader.cpp.

259{
260 if (!m_rows) {
261 m_last_error = "No XML document is open";
262 return std::nullopt;
263 }
264
265 Kakshya::CompositeArray result(m_rows->layout());
266 Kakshya::CompositeInsertion insertion(result);
267 const auto count = std::min(max_elements,
268 m_rows->size() - static_cast<size_t>(m_position));
269
270 for (size_t i = 0; i < count; ++i) {
271 const auto source = m_rows->at(static_cast<size_t>(m_position) + i);
272 if (!source || !insertion.append(*source)) {
273 m_last_error = "Could not copy XML node";
274 return std::nullopt;
275 }
276 }
277
278 m_position += count;
279 m_last_error.clear();
280 return result;
281}
std::optional< Kakshya::CompositeArray > m_rows
std::vector< double > count(std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size)
Sample count per window (as double for pipeline uniformity).
Definition Analysis.cpp:506
Source source()
Begin a Source chain.
Definition Plot.hpp:127

References MayaFlux::Kakshya::CompositeInsertion::append(), MayaFlux::IO::CompositeReader::m_last_error, m_position, and m_rows.

Referenced by read_composite().

Here is the call graph for this function:
Here is the caller graph for this function: