|
MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
|
Core grammar system for rule-based computation in Maya Flux. More...
#include <ComputeGrammar.hpp>
Collaboration diagram for MayaFlux::Yantra::ComputationGrammar:Classes | |
| struct | Rule |
| Represents a computation rule with matching and execution logic. More... | |
| class | RuleBuilder |
| Fluent interface for building rules with method chaining. More... | |
Public Member Functions | |
| void | add_rule (Rule rule) |
| Add a rule to the grammar. | |
| std::optional< Rule > | find_best_match (const std::any &input, const ExecutionContext &context) const |
| Find the best matching rule for the given input. | |
| std::optional< std::any > | execute_rule (const std::string &rule_name, const std::any &input, const ExecutionContext &context) const |
| Execute a specific rule by name. | |
| std::vector< std::string > | get_rules_by_context (ComputationContext context) const |
| Get all rule names for a specific computation context. | |
| template<typename OperationType > | |
| std::vector< std::string > | get_rules_for_operation_type () const |
| Get rules that target a specific operation type. | |
| template<typename ConcreteOpType , typename... OpArgs> | |
| void | add_operation_rule (const std::string &rule_name, ComputationContext context, UniversalMatcher::MatcherFunc matcher, const std::unordered_map< std::string, std::any > &op_parameters={}, int priority=50, OpArgs &&... op_args) |
| Helper to add concrete operation rules with automatic executor generation. | |
| RuleBuilder | create_rule (const std::string &name) |
| Create a rule builder for fluent rule construction. | |
| size_t | get_rule_count () const |
| Get the total number of rules in the grammar. | |
| std::vector< std::string > | get_all_rule_names () const |
| Get all rule names in the grammar. | |
| bool | has_rule (const std::string &rule_name) const |
| Check if a rule with the given name exists. | |
| bool | remove_rule (const std::string &rule_name) |
| Remove a rule by name. | |
| void | clear_all_rules () |
| Clear all rules from the grammar. | |
Private Attributes | |
| std::vector< Rule > | m_rules |
| All rules sorted by priority (highest first) | |
| std::unordered_map< ComputationContext, std::vector< std::string > > | m_context_index |
| Index of rule names by context for fast lookup. | |
Core grammar system for rule-based computation in Maya Flux.
The ComputationGrammar provides a powerful, declarative system for defining how computational operations should be applied based on input data characteristics, execution context, and user-defined rules. This enables intelligent, adaptive computation that can select appropriate operations dynamically.
Rules: Define when and how operations should be applied. Each rule contains:
Contexts: Categorize rules by computational domain (temporal, spectral, etc.) for efficient lookup and logical organization.
Priority System: Higher priority rules are evaluated first, allowing for hierarchical decision making and exception handling.
Definition at line 76 of file ComputeGrammar.hpp.