High level execution utilities. More...
Namespaces | |
| flow | |
| Functions for flow management. | |
Typedefs | |
| typedef Executor< InlineExecutionAgent > | InlineExecutor |
| alias for Executor<InlineExecutionAgent> | |
| typedef Executor< NaiveInlineExecutionAgent > | NaiveInlineExecutor |
| alias for Executor<NaiveInlineExecutionAgent> | |
| typedef Executor< Runnable > | RunnableExecutor |
| alias for Executor<Runnable> | |
| typedef Executor< ThreadPool > | ThreadPoolExecutor |
| alias for Executor<ThreadPool> | |
Functions | |
| template<class F , class ExecutorAgent > | |
| ExFuture< ExecutorAgent, std::invoke_result_t< F > > | launch (Executor< ExecutorAgent > ex, F &&f) |
| Launch given functor in given executor. More... | |
| template<class TArg , class F , class ExecutorAgent > | |
| ExFuture< ExecutorAgent, std::invoke_result_t< F, TArg > > | launch (Executor< ExecutorAgent > ex, F &&f, TArg &&arg) |
| Launch given functor in given executor, passing it input parameter. More... | |
| template<class ExecutorAgent > | |
| ExFuture< ExecutorAgent, void > | start (Executor< ExecutorAgent > ex) |
| Start a chain of execution in given executor. More... | |
| template<class ExecutorAgent , class TArg , class TRet > | |
| ExFuture< ExecutorAgent, typename std::remove_cv< typename std::remove_reference< TRet >::type >::type > | inmediate (ExFuture< ExecutorAgent, TArg > fut, TRet &&arg) |
| Produces an inmediate value in the context of the given ExFuture executor as a response to input fut completion If input fut has error, the this error is forwarded to inmediate result. | |
| template<class F , class TArg , class ExecutorAgent > | |
| ExFuture< ExecutorAgent, std::invoke_result_t< F, TArg > > | next (ExFuture< ExecutorAgent, TArg > source, F f) |
| Attach a functor to execute when input fut is complete Given functor will be executed inf the input ExFuture executor. input parameter is always pass as reference. More... | |
| template<class NewExecutorAgent , class OldExecutorAgent , class TRet > | |
| ExFuture< NewExecutorAgent, TRet > | transfer (ExFuture< OldExecutorAgent, TRet > source, Executor< NewExecutorAgent > newAgent) |
| Transfer given ExFuture to a different executor This way, continuations can be chained but executed in diferent executors. | |
| template<class ExecutorAgent , class TArg , class I , class F > | |
| ExFuture< ExecutorAgent, TArg > | loop (ExFuture< ExecutorAgent, TArg > source, I getIteratorsFunc, F functor, int increment=1) |
| parallel (possibly, depending on executor capabilities) loop More... | |
| template<class ExecutorAgent , class TArg , class... FTypes> | |
| ExFuture< ExecutorAgent, TArg > | parallel (ExFuture< ExecutorAgent, TArg > source, FTypes... functions) |
| Execute given functions in a (possibly, depending on concrete executor) parallel way If an exception is thrown in any of the callables, and noexcept is no specified, the value of the first exception thrown is set as error in the resulting future, so forwarding the error to the next element (if any) of the chain. More... | |
| template<class F , class TArg , class ExecutorAgent > | |
| ExFuture< ExecutorAgent, TArg > | catchError (ExFuture< ExecutorAgent, TArg > source, F &&f) |
| Capture previous error, if any, and execute the function. More... | |
| template<class TArg , class ExecutorAgent , class... FTypes> | |
| ExFuture< ExecutorAgent, typename ::mel::execution::_private::GetReturn< TArg, FTypes... >::type > | parallel_convert (ExFuture< ExecutorAgent, TArg > source, FTypes... functions) |
| Same as parallel but returning a tuple with the values for each functor. More... | |
| template<class F , class TArg , class ExecutorAgent > | |
| ExFuture< ExecutorAgent, std::invoke_result_t< F, Executor< ExecutorAgent >, TArg > > | getExecutor (ExFuture< ExecutorAgent, TArg > source, F f) |
| Get the Executor used in the chain of execution. More... | |
| template<class TRet > | |
| _private::ApplyInmediate< TRet > | inmediate (TRet &&arg) |
| template<class NewExecutionAgent > | |
| _private::ApplyTransfer< NewExecutionAgent > | transfer (Executor< NewExecutionAgent > newAgent) |
| Version for use with operator |. | |
| template<class F > | |
| _private::ApplyNext< F > | next (F &&f) |
| version for use with operator | | |
| template<class I , class F > | |
| _private::ApplyLoop< I, F > | loop (I &&getItFunc, F &&functor, int increment=1) |
| version for use with operator | | |
| template<class... FTypes> | |
| _private::ApplyBulk< FTypes... > | parallel (FTypes &&... functions) |
| version for use with operator | | |
| template<class F > | |
| _private::ApplyError< F > | catchError (F &&f) |
| version for use with operator | | |
| template<class... FTypes> | |
| _private::ApplyParallelConvert< FTypes... > | parallel_convert (FTypes &&... functions) |
| version for use with operator | | |
| template<class F > | |
| _private::ApplyGetExecutor< F > | getExecutor (F &&f) |
| version for use with operator | | |
| template<class ExecutorAgent , class TRet1 , class U > | |
| auto | operator| (const ExFuture< ExecutorAgent, TRet1 > &input, U &&u) |
| overload operator | for chaining | |
| template<class ExecutorAgent , class TRet1 , class U > | |
| auto | operator| (ExFuture< ExecutorAgent, TRet1 > &&input, U &&u) |
| template<class ExecutorAgent , class... FTypes> | |
| auto | on_all (Executor< ExecutorAgent > ex, FTypes... futs) |
| return ExFuture which will be executed, in the context of the given executor ex, when all the given ExFutures are triggered. More... | |
| template<class TArg , class I , class F > | |
| ExFuture< InlineExecutionAgent, TArg > | loop (ExFuture< InlineExecutionAgent, TArg > source, I &&getIteratorsFunc, F &&functor, int increment=1) |
| template<class I , class F > | |
| ExFuture< InlineExecutionAgent, void > | loop (ExFuture< InlineExecutionAgent, void > source, I &&getIteratorsFunc, F &&functor, int increment=1) |
| template<class TArg , class... FTypes> | |
| ExFuture< InlineExecutionAgent, TArg > | parallel (ExFuture< InlineExecutionAgent, TArg > source, FTypes &&... functions) |
| template<class TArg , class... FTypes> | |
| ExFuture< InlineExecutionAgent, typename mel::execution::_private::GetReturn< TArg, FTypes... >::type > | parallel_convert (ExFuture< InlineExecutionAgent, TArg > source, FTypes &&... functions) |
| template<class F > | |
| ExFuture< InlineExecutionAgent, std::invoke_result_t< F > > | launch (Executor< InlineExecutionAgent > ex, F &&f) |
| Launch given functor in given executor. More... | |
| template<class TArg , class F > | |
| ExFuture< InlineExecutionAgent, std::invoke_result_t< F, TArg > > | launch (Executor< InlineExecutionAgent > ex, F &&f, TArg &&arg) |
| Launch given functor in given executor, passing it input parameter. More... | |
| template<class F , class TArg > | |
| ExFuture< InlineExecutionAgent, std::invoke_result_t< F, TArg > > | next (ExFuture< InlineExecutionAgent, TArg > source, F &&f) |
| template<class F > | |
| ExFuture< InlineExecutionAgent, std::invoke_result_t< F > > | next (ExFuture< InlineExecutionAgent, void > source, F &&f) |
| template<class TArg , class TRet > | |
| ExFuture< InlineExecutionAgent, typename std::remove_cv< typename std::remove_reference< TRet >::type >::type > | inmediate (ExFuture< InlineExecutionAgent, TArg > fut, TRet &&arg) |
High level execution utilities.
This namespace contains class, functions..to give a consistent execution interface independent of the underliying execution system See Execution System for detailed explanations and examples
| ExFuture<ExecutorAgent, TArg> mel::execution::catchError | ( | ExFuture< ExecutorAgent, TArg > | source, |
| F && | f | ||
| ) |
Capture previous error, if any, and execute the function.
This function works similar to next, but receiving an std::exception_ptr as the parameter and must return same type as input future if no error was raised in previous works of the chain, the function is not executed
| ExFuture<ExecutorAgent, std::invoke_result_t<F, Executor<ExecutorAgent>, TArg> > mel::execution::getExecutor | ( | ExFuture< ExecutorAgent, TArg > | source, |
| F | f | ||
| ) |
Get the Executor used in the chain of execution.
Given callable gets current executor and the previous value and return The intent of function is to be able to check executor traits or change some option in it
| [in] | f | Callable with signature void (auto executor) |
| ExFuture<ExecutorAgent, std::invoke_result_t<F> > mel::execution::launch | ( | Executor< ExecutorAgent > | ex, |
| F && | f | ||
| ) |
Launch given functor in given executor.
| ExFuture<ExecutorAgent, std::invoke_result_t<F, TArg> > mel::execution::launch | ( | Executor< ExecutorAgent > | ex, |
| F && | f, | ||
| TArg && | arg | ||
| ) |
Launch given functor in given executor, passing it input parameter.
| ExFuture<InlineExecutionAgent, std::invoke_result_t<F> > mel::execution::launch | ( | Executor< InlineExecutionAgent > | ex, |
| F && | f | ||
| ) |
Launch given functor in given executor.
| ExFuture<InlineExecutionAgent, std::invoke_result_t<F, TArg> > mel::execution::launch | ( | Executor< InlineExecutionAgent > | ex, |
| F && | f, | ||
| TArg && | arg | ||
| ) |
Launch given functor in given executor, passing it input parameter.
| ExFuture<ExecutorAgent, TArg> mel::execution::loop | ( | ExFuture< ExecutorAgent, TArg > | source, |
| I | getIteratorsFunc, | ||
| F | functor, | ||
| int | increment = 1 |
||
| ) |
parallel (possibly, depending on executor capabilities) loop
| getIteratorsFunc | callable with signature std::array<It,2> f(TArg) returning the begin and end iterators to use in the loop |
| auto mel::execution::on_all | ( | Executor< ExecutorAgent > | ex, |
| FTypes... | futs | ||
| ) |
return ExFuture which will be executed, in the context of the given executor ex, when all the given ExFutures are triggered.
The resulting ExFuture has a std::tuple with the types if the given ExFutures in the same order. If any of the jobs returns void, its result is substituted for VoidType If any of the given input ExFuture has error, the returned one will have the same error indicating the element who failed
| OnAllException | if any error |
| ExFuture<ExecutorAgent, TArg> mel::execution::parallel | ( | ExFuture< ExecutorAgent, TArg > | source, |
| FTypes... | functions | ||
| ) |
Execute given functions in a (possibly, depending on concrete executor) parallel way If an exception is thrown in any of the callables, and noexcept is no specified, the value of the first exception thrown is set as error in the resulting future, so forwarding the error to the next element (if any) of the chain.
| ExFuture<ExecutorAgent, typename ::mel::execution::_private::GetReturn< TArg, FTypes...>::type> mel::execution::parallel_convert | ( | ExFuture< ExecutorAgent, TArg > | source, |
| FTypes... | functions | ||
| ) |
Same as parallel but returning a tuple with the values for each functor.
functors returning a void will be converted to _private::VoidType. Until 10 callables can be used