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

◆ add_processor_direct()

bool MayaFlux::Buffers::BufferProcessingChain::add_processor_direct ( const std::shared_ptr< BufferProcessor > &  processor,
const std::shared_ptr< Buffer > &  buffer,
std::string *  rejection_reason = nullptr 
)
protected

Definition at line 18 of file BufferProcessingChain.cpp.

19{
20 auto processor_token = processor->get_processing_token();
21
22 switch (m_enforcement_strategy) {
24 if (processor_token != m_token_filter_mask) {
25 if (rejection_reason) {
26 *rejection_reason = "Processor token (" + std::to_string(static_cast<uint32_t>(processor_token)) + ") does not exactly match chain's preferred token (" + std::to_string(static_cast<uint32_t>(m_token_filter_mask)) + ") in STRICT mode";
27 }
28 return false;
29 }
30 break;
31
33 if (!are_tokens_compatible(m_token_filter_mask, processor_token)) {
34 if (rejection_reason) {
35 *rejection_reason = "Processor token (" + std::to_string(static_cast<uint32_t>(processor_token)) + ") is not compatible with chain's preferred token (" + std::to_string(static_cast<uint32_t>(m_token_filter_mask)) + ") in FILTERED mode";
36 }
37 return false;
38 }
39 break;
40
42 if (!are_tokens_compatible(m_token_filter_mask, processor_token)) {
43 m_conditional_processors[buffer].insert(processor);
44 }
45 break;
46
48 if (!are_tokens_compatible(m_token_filter_mask, processor_token)) {
49 m_pending_removal[buffer].insert(processor);
50 }
51 break;
52
54 break;
55 }
56
57 auto& processors = m_buffer_processors[buffer];
58
59 auto it = std::ranges::find(processors, processor);
60
61 if (it != processors.end()) {
62 if (rejection_reason) {
63 *rejection_reason = "Processor already exists in chain for this buffer";
64 }
65 return false;
66 }
67
68 processors.push_back(processor);
69 processor->on_attach(buffer);
70
71 return true;
72}
std::unordered_map< std::shared_ptr< Buffer >, std::unordered_set< std::shared_ptr< BufferProcessor > > > m_pending_removal
Map of buffers to processors pending removal.
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.
TokenEnforcementStrategy m_enforcement_strategy
Token enforcement strategy for this chain.
std::unordered_map< std::shared_ptr< Buffer >, std::unordered_set< std::shared_ptr< BufferProcessor > > > m_conditional_processors
Map of buffers to processors that are conditionally applied.
bool are_tokens_compatible(ProcessingToken preferred, ProcessingToken current)
Determines if two processing tokens are compatible for joint execution.
@ OVERRIDE_SKIP
Allows token overrides but skips processing for incompatible operations.
@ STRICT
Strictly enforces token assignment with no cross-token sharing.
@ OVERRIDE_REJECT
Allows token overrides but rejects incompatible processors from chains.
@ FILTERED
Filters processors through token enumeration, allowing compatible combinations.
@ IGNORE
Ignores token assignments completely, allowing any processing combination.

References MayaFlux::Buffers::are_tokens_compatible(), MayaFlux::Buffers::FILTERED, MayaFlux::Buffers::IGNORE, m_buffer_processors, m_conditional_processors, m_enforcement_strategy, m_pending_removal, m_token_filter_mask, MayaFlux::Buffers::OVERRIDE_REJECT, MayaFlux::Buffers::OVERRIDE_SKIP, and MayaFlux::Buffers::STRICT.

Referenced by add_processor(), and process_pending_processor_operations().

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