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

◆ then() [2/2]

template<typename Executor , ComputeData DataType>
template<typename OpClass , ComputeData OutputType = DataType>
FluentExecutor< Executor, OutputType > MayaFlux::Yantra::FluentExecutor< Executor, DataType >::then ( const std::string &  name)
inline

Chain a named operation fetched from the executor's pool.

Retrieves the pre-configured operation instance registered under name and executes it on the current Datum. The full Datum is passed through, preserving container and metadata.

Template Parameters
OpClassOperation class type
OutputTypeExpected output type (defaults to current DataType)
Parameters
nameName of the operation in the pool
Returns
New FluentExecutor carrying the result Datum

Definition at line 175 of file OperationChain.hpp.

176 {
177 if (!m_successful) {
178 error<std::runtime_error>(
180 std::source_location::current(),
181 "Cannot continue chain after failed operation: {}", name);
182 }
183
184 try {
185 auto result = m_executor->template execute_named<OpClass, DataType, OutputType>(name, m_data);
186 if (!result) {
187 m_successful = false;
188 record_error("Named operation '" + name + "' failed");
189 error<std::runtime_error>(
191 std::source_location::current(),
192 "Named operation failed in fluent chain: {}", name);
193 }
194
195 auto next = FluentExecutor<Executor, OutputType>(m_executor, std::move(*result));
196 next.m_operation_history = m_operation_history;
197 next.m_operation_history.push_back(name);
198 return next;
199 } catch (const std::exception& e) {
200 m_successful = false;
201 record_error(e.what());
204 std::source_location::current(),
205 "Exception in named operation '{}': {}", name, e.what());
206 }
207 }
void record_error(const std::string &err)
std::shared_ptr< Executor > m_executor
std::vector< std::string > m_operation_history
@ ComputeMatrix
Compute operations (Yantra - algorithms, matrices, DSP)
void error_rethrow(Component component, Context context, std::source_location location=std::source_location::current(), std::string_view additional_context="")
Catch and log an exception, then rethrow it.
@ Yantra
DSP algorithms, computational units, matrix operations, Grammar.