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

◆ instantiate_rows() [1/2]

template<typename Source, typename Access = Reflect::RecordAccess<Source>>
std::optional< std::vector< uint32_t > > MayaFlux::Portal::Forma::instantiate_rows ( const FactoryTable< Source, Access > & table,
const Source & root,
std::string_view template_id,
const Kakshya::CompositeArray & rows,
Surface & surface,
std::string & error )
nodiscard

Make one element per row of typed placements from a single template.

The template's factory must have been registered with expose_typed. Its inputs are decoded once and each row, laid out as the described composite layout of the factory's placement type, becomes one element on surface. Everything is prepared before anything is placed. Rows carry no ids, so the elements are not named.

Parameters
template_idId of a template in the document.
rowsOne row of placement values per element.
Returns
The element id of each row in row order, or nullopt with the reason in error.

Definition at line 852 of file Instantiate.hpp.

856{
857 error.clear();
858 Detail::DocumentWalk<Source, Access> walk(table, root, error);
859 if (!walk.read_structure())
860 return std::nullopt;
861 const auto placers = walk.prepare_bulk(template_id, rows);
862 if (!placers)
863 return std::nullopt;
864
865 std::vector<uint32_t> elements;
866 elements.reserve(placers->size());
867 for (const auto& placer : *placers) {
868 const auto element = placer(surface, error);
869 if (!element)
870 return std::nullopt;
871 elements.push_back(*element);
872 }
873 return elements;
874}

References instantiate_rows(), MayaFlux::Portal::Forma::Detail::DocumentWalk< Source, Access >::prepare_bulk(), and MayaFlux::Portal::Forma::Detail::DocumentWalk< Source, Access >::read_structure().

Referenced by instantiate_rows(), and instantiate_rows().

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