Apply a custom transformation function within the chain.
345 {
347 error<std::runtime_error>(
349 std::source_location::current(),
350 "Cannot continue chain after failed operation in apply");
351 }
352
353 using ResultType = std::invoke_result_t<Func, const DataType&>;
354
355 try {
356 auto result = std::forward<Func>(func)(
m_data.
data);
357 auto next = FluentExecutor<Executor, ResultType>(
358 m_executor, Datum<ResultType>(std::move(result)));
360 next.m_operation_history.push_back("custom_function");
361 return next;
362 } catch (const std::exception& e) {
364 record_error(std::string(
"Custom function failed: ") + e.what());
367 std::source_location::current(),
368 "Exception in custom function: " + std::string(e.what()));
369 }
370 }
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.
T data
The actual computation data.