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

◆ merge_chain()

void MayaFlux::Buffers::BufferProcessingChain::merge_chain ( const std::shared_ptr< BufferProcessingChain > &  other)

Combines another processing pipeline into this one with optimization.

Parameters
otherChain to merge into this one

Adds all processors from the other chain to this one, preserving their buffer associations and order while performing intelligent optimization. This enables the composition of complex transformation pipelines from simpler, reusable components:

  • Compatibility Analysis: Validates that merged processors are compatible
  • Optimization Opportunities: Identifies potential performance improvements in the combined pipeline
  • Resource Consolidation: Optimizes resource usage across the merged processors
  • Backend Harmonization: Resolves any backend conflicts between the chains

Definition at line 324 of file BufferProcessingChain.cpp.

325{
326 for (const auto& [buffer, processors] : other->get_chain()) {
327 if (!m_buffer_processors.count(buffer)) {
328 m_buffer_processors.try_emplace(buffer, processors);
329 } else {
330 auto& target_processors = m_buffer_processors[buffer];
331 target_processors.reserve(target_processors.size() + processors.size());
332
333 for (const auto& processor : processors) {
334 if (std::ranges::find(target_processors, processor) == target_processors.end()) {
335 target_processors.push_back(processor);
336 }
337 }
338 }
339 }
340}
std::shared_ptr< NetworkGeometryBuffer > buffer
std::unordered_map< std::shared_ptr< Buffer >, std::vector< std::shared_ptr< BufferProcessor > > > m_buffer_processors
Map of buffers to their processor sequences.
std::unordered_map< std::shared_ptr< Buffer >, std::vector< std::shared_ptr< BufferProcessor > > > get_chain() const
Gets the entire transformation pipeline structure.

References buffer, and m_buffer_processors.