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

◆ then() [2/4]

template<typename Executor , ComputeData DataType>
template<typename OpClass >
requires FunctionalOperationOn<OpClass, DataType>
FluentExecutor< Executor, DataType > MayaFlux::Yantra::FluentExecutor< Executor, DataType >::then ( )
inline

Chain a FunctionalOperation child 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 the operation's type name.

Definition at line 246 of file OperationChain.hpp.

247 {
248 using OutputType = typename detail::datum_data<typename OpClass::output_type>::type;
249
250 if (!m_successful) {
251 error<std::runtime_error>(
253 std::source_location::current(),
254 "Cannot continue chain after failed operation");
255 }
256
257 const std::string key = typeid(OpClass).name();
258 try {
259 auto result = m_executor->template execute<OpClass, DataType, OutputType>(m_data);
260 if (!result) {
261 m_successful = false;
262 record_error("Operation " + key + " failed");
263 error<std::runtime_error>(
265 std::source_location::current(),
266 "Operation failed in fluent chain: {}", key);
267 }
268
269 auto next = FluentExecutor<Executor, DataType>(m_executor, absorbed(std::move(*result), key));
270 next.m_operation_history = m_operation_history;
271 next.m_operation_history.push_back(key);
272 return next;
273 } catch (const std::exception& e) {
274 m_successful = false;
275 record_error(e.what());
278 std::source_location::current(),
279 "Exception in fluent chain: " + std::string(e.what()));
280 }
281 }
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.