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

◆ then() [1/4]

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

Chain an anonymous operation instance by type.

Constructs a new instance of OpClass and executes it on the current Datum. The full Datum (data + container + metadata) is passed through.

Template Parameters
OpClassOperation class to instantiate and execute
OutputTypeExpected output type (defaults to current DataType)
Returns
New FluentExecutor carrying the result Datum

Definition at line 154 of file OperationChain.hpp.

155 {
156 if (!m_successful) {
157 error<std::runtime_error>(
159 std::source_location::current(),
160 "Cannot continue chain after failed operation");
161 }
162
163 try {
164 auto result = m_executor->template execute<OpClass, DataType, OutputType>(m_data);
165 if (!result) {
166 m_successful = false;
167 record_error("Operation " + std::string(typeid(OpClass).name()) + " failed");
168 error<std::runtime_error>(
170 std::source_location::current(),
171 "Operation failed in fluent chain: {}", std::string(typeid(OpClass).name()));
172 }
173
174 auto next = FluentExecutor<Executor, OutputType>(m_executor, std::move(*result));
175 next.m_operation_history = m_operation_history;
176 next.m_operation_history.push_back(typeid(OpClass).name());
177 return next;
178 } catch (const std::exception& e) {
179 m_successful = false;
180 record_error(e.what());
183 std::source_location::current(),
184 "Exception in fluent chain: " + std::string(e.what()));
185 }
186 }
std::string name
Definition VKDevice.cpp:123
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.

References name.