14#ifndef ZYPPNG_MONADIC_REDO_H_INCLUDED
15#define ZYPPNG_MONADIC_REDO_H_INCLUDED
17#include <zypp-core/zyppng/pipelines/AsyncResult>
18#include <zypp-core/zyppng/meta/FunctionTraits>
19#include <zypp-core/zyppng/meta/TypeTraits>
20#include <zypp-core/zyppng/meta/Functional>
27 template<
typename Task,
typename Pred,
typename =
void >
33 template <
typename T,
typename P>
38 template <
typename Arg>
40 Arg store = std::forward<Arg>(
arg);
44 return std::move(
res);
48 template <
typename T,
typename P>
58 template<
typename MyAsyncOp,
typename Pred >
61 using Task = std::shared_ptr<MyAsyncOp>;
62 using OutType =
typename MyAsyncOp::value_type;
64 template <
typename T,
typename P>
71 template<
typename InType>
76 this->
operator()(std::move(
inArg));
78 this->setReady( std::move(
a) );
84 template <
typename T,
typename P>
86 return std::make_shared<RedoWhileImpl>( std::forward<T>(
t), std::forward<P>(
p));
97 template<
typename Task,
typename Pred >
98 struct RedoWhileImpl< Task,Pred,
std::enable_if_t< is_async_op< remove_smart_ptr_t<typename function_traits<Task>::return_type> >::value > > :
public AsyncOp< typename remove_smart_ptr_t<typename function_traits<Task>::return_type>::value_type> {
105 template <
typename T,
typename P>
110 template<
typename InType>
117 this->
operator()( std::move(
inArg) );
119 this->setReady( std::move(
arg) );
123 template <
typename T,
typename P>
125 return std::make_shared<RedoWhileImpl>( std::forward<T>(
t), std::forward<P>(
p));
136 template <
typename T>
141 template <
typename Task,
typename Pred>
144 static_assert ( std::is_detected_v< detail::has_func_trait, Task >,
"Not possible to deduce the function_traits for Task, maybe a generic lambda?" );
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
typename enable_if< B, T >::type enable_if_t
typename result_of< T >::type result_of_t
typename function_traits< T >::return_type has_func_trait
typename remove_smart_ptr< T >::type remove_smart_ptr_t
auto redo_while(Task &&todo, Pred &&until)
static auto create(T &&t, P &&p)
RedoWhileImpl(T &&t, P &&p)
std::shared_ptr< AsyncOp< OutType > > _asyncRes
typename FunRet::value_type OutType
RedoWhileImpl(T &&t, P &&p)
std::shared_ptr< AsyncOp< OutType > > _pipeline
void operator()(InType &&arg)
typename MyAsyncOp::value_type OutType
static auto create(T &&t, P &&p)
std::shared_ptr< MyAsyncOp > Task
std::enable_if_t< is_async_op< remove_smart_ptr_t< std::result_of_t< Task(Arg)> > >::value==false, Arg > operator()(Arg &&arg)
RedoWhileImpl(T &&t, P &&p)
static auto create(T &&t, P &&p)