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

◆ collect_records()

template<Reflect::Described T, typename Source, typename Access>
std::optional< Kakshya::CompositeArray > MayaFlux::IO::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 )
nodiscard

Decode the same-named children of a source element into typed Composite rows.

Each child named child_name is read through the binding and stored as one row of the layout derived from T. The source can be any type with a RecordAccess specialization, so the result does not depend on the file format.

Parameters
bindingConfigured binding for T.
parentSource element whose children are read.
child_nameName of the children that hold one record each.
errorReceives the reason when nullopt is returned.
error_locationReceives the position of the failing element when given.
Returns
The rows, empty when no child matches, or nullopt on the first failure.

Definition at line 23 of file DescribedRecords.hpp.

27{
29 Kakshya::CompositeInsertion insertion(rows);
30 const bool traversed = Access::for_each_child(parent, [&](const Source& child) {
31 if (Access::name(child) != child_name)
32 return true;
33 const auto record = binding.read(child, error, error_location);
34 if (!record)
35 return false;
36 return Kakshya::write_described(insertion, insertion.append(), *record, error);
37 });
38 if (!traversed)
39 return std::nullopt;
40 return rows;
41}
Owns a sequence of values that share a CompositeLayout.
Mutable insertion adapter for a CompositeArray.
std::optional< Input > read(const Source &source, std::string &error, uint64_t *error_location=nullptr) const
Decode the source element into a new Input.
CompositeLayout described_composite_layout()
Derive a Composite layout from a generated member description.
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.
Definition Rigs.cpp:262

References MayaFlux::Kakshya::CompositeInsertion::append(), MayaFlux::Kakshya::described_composite_layout(), MayaFlux::Reflect::RecordBinding< Input, Source, Access >::read(), MayaFlux::record(), and MayaFlux::Kakshya::write_described().

Here is the call graph for this function: