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

◆ create_configured_operation()

template<typename OperationType , typename... Args>
std::shared_ptr< OperationType > MayaFlux::Yantra::create_configured_operation ( const std::unordered_map< std::string, std::any > &  parameters,
Args &&...  args 
)

Creates an operation instance with parameters using safe_any_cast system.

Template Parameters
OperationTypeType of operation to create
ArgsConstructor argument types
Parameters
parametersMap of parameter names to values
argsConstructor arguments
Returns
Configured operation instance

Definition at line 118 of file GrammarHelper.hpp.

121{
122 auto operation = std::make_shared<OperationType>(std::forward<Args>(args)...);
123
124 for (const auto& [param_name, param_value] : parameters) {
125 try {
126 operation->set_parameter(param_name, param_value);
127 } catch (...) {
128 MF_DEBUG(
129 Journal::Component::Yantra,
130 Journal::Context::Runtime,
131 "Parameter '{}' with type {} does not apply to operation '{}'",
132 param_name,
133 param_value.type().name(),
134 operation->get_name());
135 }
136 }
137
138 return operation;
139}
#define MF_DEBUG(comp, ctx,...)

References MF_DEBUG, MayaFlux::Journal::Runtime, and MayaFlux::Journal::Yantra.