|
MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
|
Fluent interface for chaining operations on any executor. More...
#include <OperationChain.hpp>
Collaboration diagram for MayaFlux::Yantra::FluentExecutor< Executor, DataType >:Public Types | |
| using | data_type = DataType |
| using | executor_type = Executor |
| using | io_type = Datum< DataType > |
Public Member Functions | |
| template<typename Func > requires std::invocable<Func, const DataType&> | |
| auto | apply (Func &&func) |
| Apply a custom transformation function within the chain. | |
| DataType | consume () && |
| Move the final raw result out of the chain. | |
| Datum< DataType > | consume_datum () && |
| Move the full result Datum out of the chain. | |
| FluentExecutor (std::shared_ptr< Executor > executor, const DataType &input) | |
| Construct with executor and raw data (convenience entry point) | |
| FluentExecutor (std::shared_ptr< Executor > executor, const Datum< DataType > &input) | |
| Construct with executor and Datum input. | |
| FluentExecutor (std::shared_ptr< Executor > executor, DataType &&input) | |
| Construct with executor and raw data (move, convenience entry point) | |
| FluentExecutor (std::shared_ptr< Executor > executor, Datum< DataType > &&input) | |
| Construct with executor and Datum input (move) | |
| template<typename... OpClasses> | |
| auto | fork () |
| Fork execution into multiple independent parallel paths. | |
| const DataType & | get () const |
| Get the final raw result by const reference. | |
| const Datum< DataType > & | get_datum () const |
| Get the full result Datum by const reference. | |
| const std::vector< std::string > & | get_errors () const |
| Get all errors accumulated during the chain. | |
| std::shared_ptr< Executor > | get_executor () const |
| Get the underlying executor. | |
| const std::vector< std::string > & | get_history () const |
| Get the ordered list of operation names executed so far. | |
| DataType & | get_mutable () |
| Get a mutable reference to the final raw result. | |
| DataType | get_or (const DataType &default_value) const |
| Return the raw result or a fallback value if the chain failed. | |
| template<typename Generator > requires std::invocable<Generator> | |
| DataType | get_or_else (Generator &&generator) const |
| Return the raw result or invoke a generator if the chain failed. | |
| bool | is_successful () const |
| Check whether all operations in the chain have succeeded. | |
| FluentExecutor & | reset (const DataType &new_data) |
| Reset the chain with raw data (convenience overload) | |
| FluentExecutor & | reset (const Datum< DataType > &new_datum) |
| Reset the chain with a new Datum, clearing history and errors. | |
| template<typename Func > requires std::invocable<Func, DataType&> | |
| FluentExecutor & | tap (Func &&func) |
| Apply a side-effect function without changing data or type. | |
| template<typename OpClass , ComputeData OutputType = DataType> | |
| FluentExecutor< Executor, OutputType > | then () |
| Chain an anonymous operation instance by type. | |
| template<typename OpClass , ComputeData OutputType = DataType> | |
| FluentExecutor< Executor, OutputType > | then (const std::string &name) |
| Chain a named operation fetched from the executor's pool. | |
| Datum< DataType > | to_io () const |
| Return the result Datum with execution history appended to metadata. | |
| template<typename OpClass > | |
| FluentExecutor & | when (bool condition) |
| Execute an operation conditionally on a boolean flag. | |
| template<typename OpClass , typename Pred > requires std::predicate<Pred, const DataType&> | |
| FluentExecutor & | when (Pred &&predicate) |
| Execute an operation conditionally on a predicate over the raw data. | |
Private Member Functions | |
| void | record_error (const std::string &err) |
Private Attributes | |
| Datum< DataType > | m_data |
| std::vector< std::string > | m_errors |
| std::shared_ptr< Executor > | m_executor |
| std::vector< std::string > | m_operation_history |
| bool | m_successful |
Friends | |
| template<typename E , ComputeData U> | |
| class | FluentExecutor |
Fluent interface for chaining operations on any executor.
Provides a composable, type-safe way to chain operations together. This class is executor-agnostic and can work with any executor that exposes execute<OpClass, InputType, OutputType>(Datum<InputType>) and execute_named<OpClass, InputType, OutputType>(name, Datum<InputType>).
Internal storage is always Datum<DataType>, preserving container references and structural metadata across every link in the chain. Entry points (constructors, make_fluent) accept raw DataType as a convenience and wrap it immediately.
Key Features:
Usage:
Definition at line 39 of file OperationChain.hpp.