19{
20 auto processor_token = processor->get_processing_token();
21
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
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
44 }
45 break;
46
50 }
51 break;
52
54 break;
55 }
56
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.