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);
 
   42          auto res = 
_task ( Arg(store) );
 
   44            return std::move(res);
 
 
   48      template <
typename T, 
typename P>
 
   49      static auto create ( T &&t, P &&p ) {
 
   50        return RedoWhileImpl( std::forward<T>(t), std::forward<P>(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>
 
   74          [
this, inArg = arg]( 
OutType &&
a) 
mutable {
 
   81        _task->operator()(  InType(arg) );
 
 
   84      template <
typename T, 
typename P>
 
   85      static auto create ( T &&t, P &&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>
 
  115          [
this, inArg = arg ]( 
OutType &&arg ) 
mutable {
 
 
  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>
 
typename enable_if< B, T >::type enable_if_t
typename result_of< T >::type result_of_t
constexpr bool is_detected_v
std::conjunction< has_value_type< remove_smart_ptr_t< T > >, is_asyncop_type< remove_smart_ptr_t< T > > > is_async_op
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)
void setReady(value_type &&val)
static auto create(T &&t, P &&p)
remove_smart_ptr_t< typename function_traits< Task >::return_type > FunRet
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)