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

◆ then() [2/2]

template<typename Executor , ComputeData DataType>
template<typename OpClass , ComputeData OutputType = DataType>
FluentExecutor< Executor, OutputType > MayaFlux::Yantra::FluentExecutor< Executor, DataType >::then ( const std::string &  name)
inline

Chain named operation.

Template Parameters
OpClassOperation class to execute
OutputTypeExpected output type
Parameters
nameName of the operation in the pool
Returns
New FluentExecutor with transformed data

Definition at line 115 of file OperationChain.hpp.

116 {
117 if (!m_successful) {
118 throw std::runtime_error("Cannot continue chain after failed operation");
119 }
120
121 try {
122 auto result = m_executor->template execute<OpClass, DataType, OutputType>(name, m_data);
123 if (!result) {
124 m_successful = false;
125 record_error("Named operation '" + name + "' failed");
126 throw std::runtime_error("Named operation failed in fluent chain: " + name);
127 }
128
129 auto next = FluentExecutor<Executor, OutputType>(m_executor, std::move(result->data));
130 next.m_operation_history = m_operation_history;
131 next.m_operation_history.push_back(name);
132 return next;
133 } catch (const std::exception& e) {
134 m_successful = false;
135 record_error(e.what());
136 throw;
137 }
138 }
std::shared_ptr< Executor > m_executor
std::vector< std::string > m_operation_history
void record_error(const std::string &error)