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

◆ enforce_chain_token_on_processors()

void MayaFlux::Buffers::BufferProcessingChain::enforce_chain_token_on_processors ( )

Enforces the chain's preferred processing token on all processors.

This method ensures that all processors in the chain are compatible with the preferred processing token, applying any necessary optimizations or removals of incompatible processors. It is typically called after setting a new preferred token or changing the enforcement strategy to ensure the pipeline remains valid.

Definition at line 325 of file BufferProcessingChain.cpp.

326{
327 for (const auto& [buffer, processors] : m_buffer_processors) {
328 for (auto& processor : processors) {
329 auto processor_token = processor->get_processing_token();
330 if (processor_token != m_token_filter_mask && are_tokens_compatible(m_token_filter_mask, processor_token)) {
331
332 // Try to set the processor to the chain's preferred token
333 try {
334 processor->set_processing_token(m_token_filter_mask);
335 } catch (const std::exception& e) {
337 std::source_location::current(),
338 "Failed to enforce chain token on processor: " + std::string(e.what()));
339 }
340 }
341 }
342 }
343}
ProcessingToken m_token_filter_mask
Preferred processing token for this chain.
std::unordered_map< std::shared_ptr< Buffer >, std::vector< std::shared_ptr< BufferProcessor > > > m_buffer_processors
Map of buffers to their processor sequences.
bool are_tokens_compatible(ProcessingToken preferred, ProcessingToken current)
Determines if two processing tokens are compatible for joint execution.
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
void error_rethrow(Component component, Context context, std::source_location location=std::source_location::current(), std::string_view additional_context="")
Catch and log an exception, then rethrow it.
@ Buffers
Buffers, Managers, processors and processing chains.

References MayaFlux::Buffers::are_tokens_compatible(), MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, m_buffer_processors, and m_token_filter_mask.

+ Here is the call graph for this function: