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

◆ tap()

template<typename Executor , ComputeData DataType>
template<typename Func >
requires std::invocable<Func, DataType&>
FluentExecutor & MayaFlux::Yantra::FluentExecutor< Executor, DataType >::tap ( Func &&  func)
inline

Apply a side-effect function without changing data or type.

func receives a mutable reference to the raw DataType. Useful for logging, validation, or in-place mutation that does not change type. Does not affect the Datum wrapper or container.

Template Parameters
FuncCallable type: (DataType&) -> void
Parameters
funcFunction to apply for side effects
Returns
Reference to this executor for continued chaining

Definition at line 385 of file OperationChain.hpp.

386 {
387 if (!m_successful) {
388 error<std::runtime_error>(
390 std::source_location::current(),
391 "Cannot continue chain after failed operation in tap");
392 }
393
394 try {
395 std::forward<Func>(func)(m_data.data);
396 m_operation_history.emplace_back("tap");
397 return *this;
398 } catch (const std::exception& e) {
399 m_successful = false;
400 record_error(std::string("Tap function failed: ") + e.what());
403 std::source_location::current(),
404 "Exception in tap function: " + std::string(e.what()));
405 }
406 }
void record_error(const std::string &err)
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.
Definition DataIO.hpp:27