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

◆ find_best_match()

std::optional< Rule > MayaFlux::Yantra::ComputationGrammar::find_best_match ( const std::any &  input,
const ExecutionContext context 
) const
inline

Find the best matching rule for the given input.

Parameters
inputInput data to match against rules
contextExecution context containing parameters and metadata
Returns
First rule that matches the input/context, or nullopt if no match

Rules are evaluated in priority order (highest first). The first rule whose matcher function returns true is considered the best match. This allows for hierarchical decision making where specific rules can override general ones.

Note
The matcher function receives both the input data and execution context, allowing for complex matching logic based on data type, content, and context

Definition at line 149 of file ComputeGrammar.hpp.

150 {
151 for (const auto& rule : m_rules) {
152 if (rule.matcher(input, context)) {
153 return rule;
154 }
155 }
156 return std::nullopt;
157 }
Core::GlobalInputConfig input
Definition Config.cpp:38
std::vector< Rule > m_rules
All rules sorted by priority (highest first)

References input.