MayaFlux 0.4.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 265 of file OperationChain.hpp.

266 {
267 if (!m_successful) {
268 error<std::runtime_error>(
270 std::source_location::current(),
271 "Cannot continue chain after failed operation in tap");
272 }
273
274 try {
275 std::forward<Func>(func)(m_data.data);
276 m_operation_history.emplace_back("tap");
277 return *this;
278 } catch (const std::exception& e) {
279 m_successful = false;
280 record_error(std::string("Tap function failed: ") + e.what());
283 std::source_location::current(),
284 "Exception in tap function: " + std::string(e.what()));
285 }
286 }
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:25