22template <Reflect::Described T,
typename Source,
typename Access>
25 const Source& parent, std::string_view child_name,
26 std::string& error, uint64_t* error_location =
nullptr)
30 const bool traversed = Access::for_each_child(parent, [&](
const Source& child) {
31 if (Access::name(child) != child_name)
33 const auto record = binding.
read(child, error, error_location);
52template <Reflect::Described T>
57 error =
"Composite layout does not match the described type";
60 std::vector<T> values;
61 values.reserve(rows.
size());
62 for (
size_t i = 0; i < rows.
size(); ++i) {
63 const auto row = rows.
at(i);
67 values.push_back(std::move(value));
size_t size() const noexcept
Number of packed elements.
const CompositeLayout & layout() const noexcept
Finalized layout shared by all elements.
std::optional< Composite > at(size_t index) const noexcept
Borrow an element by index.
Owns a sequence of values that share a CompositeLayout.
size_t append()
Append an empty element.
Mutable insertion adapter for a CompositeArray.
bool same_structure(const CompositeLayout &other) const noexcept
Compare declared field names, kinds, and nested layouts.
std::optional< Input > read(const Source &source, std::string &error, uint64_t *error_location=nullptr) const
Decode the source element into a new Input.
Bind described attributes and configured child collections of a source element.
std::optional< std::vector< T > > records_of(const Kakshya::CompositeArray &rows, std::string &error)
Decode every row of a typed Composite array into values.
std::optional< Kakshya::CompositeArray > collect_records(const Reflect::RecordBinding< T, Source, Access > &binding, const Source &parent, std::string_view child_name, std::string &error, uint64_t *error_location=nullptr)
Decode the same-named children of a source element into typed Composite rows.
CompositeLayout described_composite_layout()
Derive a Composite layout from a generated member description.
bool overlay_described(const Composite &source, T &target, std::string &error)
Apply present Composite fields to a described value, preserving other members.
bool write_described(CompositeInsertion &insertion, size_t row, const T &value, std::string &error)
Write all described members into an existing Composite row.
std::pair< std::shared_ptr< Kriya::BufferPipeline >, std::shared_ptr< Buffers::AudioBuffer > > record(const std::shared_ptr< Kakshya::DynamicSoundStream > &stream, uint32_t input_channel, double seconds, std::optional< uint32_t > monitor, uint32_t channel)
Record a live input channel into a stream for a number of seconds.