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

◆ is_buffer_acceptable()

template<typename BufferType >
bool MayaFlux::Buffers::RootBuffer< BufferType >::is_buffer_acceptable ( const std::shared_ptr< BufferType > &  buffer,
std::string *  rejection_reason = nullptr 
) const
inline

Validates if a buffer is acceptable based on current token enforcement strategy.

Parameters
bufferBuffer to validate
rejection_reasonOptional output parameter for rejection reason
Returns
True if buffer is acceptable, false otherwise

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.

Definition at line 169 of file RootBuffer.hpp.

170 {
171 auto default_processor = buffer->get_default_processor();
172 if (!default_processor) {
173 return true;
174 }
175
176 ProcessingToken child_token = default_processor->get_processing_token();
177
180 if (child_token != m_preferred_processing_token) {
181 if (rejection_reason) {
182 *rejection_reason = "Child buffer's default processor token does not match preferred processing token (STRICT mode)";
183 }
184 return false;
185 }
186 break;
187
190 if (rejection_reason) {
191 *rejection_reason = "Child buffer's default processor token is not compatible with preferred processing token (FILTERED mode)";
192 }
193 return false;
194 }
195 break;
196
199 if (rejection_reason) {
200 *rejection_reason = "Child buffer token is incompatible but will be conditionally processed (OVERRIDE_SKIP mode)";
201 }
202 }
203 break;
204
207 if (rejection_reason) {
208 *rejection_reason = "Child buffer token is incompatible and will be removed later (OVERRIDE_REJECT mode)";
209 }
210 }
211 break;
212
214 break;
215 }
216
217 return true;
218 }
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.

References MayaFlux::Buffers::are_tokens_compatible().

+ Here is the call graph for this function: