Validates if a buffer is acceptable based on current token enforcement strategy.
This method encapsulates all token compatibility validation logic based on the current enforcement strategy. It provides a clean separation between validation logic and the actual buffer addition process, making the code more maintainable and testable.
168 {
169 auto default_processor = buffer->get_default_processor();
170 if (!default_processor) {
171 return true;
172 }
173
174 ProcessingToken child_token = default_processor->get_processing_token();
175
179 if (rejection_reason) {
180 *rejection_reason = "Child buffer's default processor token does not match preferred processing token (STRICT mode)";
181 }
182 return false;
183 }
184 break;
185
188 if (rejection_reason) {
189 *rejection_reason = "Child buffer's default processor token is not compatible with preferred processing token (FILTERED mode)";
190 }
191 return false;
192 }
193 break;
194
197 if (rejection_reason) {
198 *rejection_reason = "Child buffer token is incompatible but will be conditionally processed (OVERRIDE_SKIP mode)";
199 }
200 }
201 break;
202
205 if (rejection_reason) {
206 *rejection_reason = "Child buffer token is incompatible and will be removed later (OVERRIDE_REJECT mode)";
207 }
208 }
209 break;
210
212 break;
213 }
214
215 return true;
216 }
ProcessingToken m_preferred_processing_token
Preferred processing token for this root buffer.
TokenEnforcementStrategy m_token_enforcement_strategy
Current token enforcement strategy for this root buffer.
bool are_tokens_compatible(ProcessingToken preferred, ProcessingToken current)
Determines if two processing tokens are compatible for joint execution.
ProcessingToken
Bitfield enum defining processing characteristics and backend requirements for buffer operations.
@ 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.