MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
CompositeWriter.cpp
Go to the documentation of this file.
1#include "CompositeWriter.hpp"
2
3namespace MayaFlux::IO {
4
6 const std::string& filepath,
7 const Kakshya::CompositeArray& array)
8{
9 if (!open(filepath, array.layout()))
10 return false;
11
12 const auto rows = array.slice(0, array.size());
13 const bool accepted = rows && write_rows(*rows);
14 const bool finalized = close();
15
16 return accepted && finalized;
17}
18
19}
uint32_t rows
bool accepted
Definition Scheduler.cpp:30
bool write(const std::string &filepath, const Kakshya::CompositeArray &array)
Write a complete array in one call.
virtual bool open(const std::string &filepath, const Kakshya::CompositeLayout &layout)=0
Open a new file with the schema all subsequent slices must use.
virtual bool close()=0
Finish the file and release its output stream.
virtual bool write_rows(const Kakshya::CompositeSlice &rows)=0
Write a bounded slice of elements.
size_t size() const noexcept
Number of packed elements.
const CompositeLayout & layout() const noexcept
Finalized layout shared by all elements.
std::optional< CompositeSlice > slice(size_t start, size_t count) const
Borrow consecutive elements without copying.
Owns a sequence of values that share a CompositeLayout.