MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Yantra::ComputationGrammar::RuleBuilder Class Reference

Fluent interface for building rules with method chaining. More...

#include <ComputeGrammar.hpp>

+ Collaboration diagram for MayaFlux::Yantra::ComputationGrammar::RuleBuilder:

Public Member Functions

 RuleBuilder (ComputationGrammar *grammar, std::string name)
 Constructs a RuleBuilder for the specified grammar.
 
RuleBuilderwith_context (ComputationContext context)
 Sets the computation context for this rule.
 
RuleBuilderwith_priority (int priority)
 Sets the execution priority for this rule.
 
RuleBuilderwith_description (std::string description)
 Sets a human-readable description for this rule.
 
template<ComputeData DataType>
RuleBuildermatches_type ()
 Sets the matcher to check for a specific data type.
 
RuleBuildermatches_custom (UniversalMatcher::MatcherFunc matcher)
 Sets a custom matcher function.
 
template<typename Func >
RuleBuilderexecutes (Func &&executor)
 Sets the executor function for this rule.
 
template<typename OperationType >
RuleBuildertargets_operation ()
 Sets the target operation type for this rule.
 
RuleBuilderwith_tags (std::vector< std::string > tags)
 Sets arbitrary tags for this rule.
 
void build ()
 Finalizes and adds the rule to the grammar.
 

Private Attributes

Rule m_rule
 Rule being constructed.
 
ComputationGrammarm_grammar
 Reference to parent grammar.
 

Detailed Description

Fluent interface for building rules with method chaining.

The RuleBuilder provides a clean, readable way to construct complex rules using method chaining. This pattern makes rule creation more expressive and helps catch configuration errors at compile time.

Example usage:

grammar.create_rule("complex_temporal_rule")
.with_priority(75)
.with_description("Applies gain when signal is quiet")
.matches_type<std::vector<double>>()
.with_tags({"audio", "gain", "dynamic"})
.executes([](const std::any& input, const ExecutionContext& ctx) {
// Custom logic here
return input;
})
.build();
void build()
Finalizes and adds the rule to the grammar.
RuleBuilder & executes(Func &&executor)
Sets the executor function for this rule.
RuleBuilder & targets_operation()
Sets the target operation type for this rule.
Concrete transformer for mathematical operations.
@ TEMPORAL
Time-domain operations.
Context information for operation execution.

Definition at line 312 of file ComputeGrammar.hpp.


The documentation for this class was generated from the following file: