MayaFlux 0.1.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 141 of file ComputeGrammar.hpp.

142 {
143 for (const auto& rule : m_rules) {
144 if (rule.matcher(input, context)) {
145 return rule;
146 }
147 }
148 return std::nullopt;
149 }
std::vector< Rule > m_rules
All rules sorted by priority (highest first)