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

◆ then() [4/4]

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

Chain a named FunctionalOperation child from the executor's pool as an annotation of the current Datum.

The chain keeps its data, container and type. The operation's output metadata is merged into the chain's, and its output data is stored in the metadata under name.

Definition at line 293 of file OperationChain.hpp.

294 {
295 using OutputType = typename detail::datum_data<typename OpClass::output_type>::type;
296
297 if (!m_successful) {
298 error<std::runtime_error>(
300 std::source_location::current(),
301 "Cannot continue chain after failed operation: {}", name);
302 }
303
304 try {
305 auto result = m_executor->template execute_named<OpClass, DataType, OutputType>(name, m_data);
306 if (!result) {
307 m_successful = false;
308 record_error("Named operation '" + name + "' failed");
309 error<std::runtime_error>(
311 std::source_location::current(),
312 "Named operation failed in fluent chain: {}", name);
313 }
314
315 auto next = FluentExecutor<Executor, DataType>(m_executor, absorbed(std::move(*result), name));
316 next.m_operation_history = m_operation_history;
317 next.m_operation_history.push_back(name);
318 return next;
319 } catch (const std::exception& e) {
320 m_successful = false;
321 record_error(e.what());
324 std::source_location::current(),
325 "Exception in named operation '{}': {}", name, e.what());
326 }
327 }
std::string name
Definition VKDevice.cpp:123
void record_error(const std::string &err)
std::shared_ptr< Executor > m_executor
Datum< DataType > absorbed(Datum< OutputType > &&result, const std::string &key) const
The current Datum with result's metadata merged in and its data stored under key.
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.

References name.