14#ifndef ZYPP_ZYPPNG_MONADIC_WAIT_H
15#define ZYPP_ZYPPNG_MONADIC_WAIT_H
17#include <zypp-core/zyppng/pipelines/AsyncResult>
24 template <
template<
class,
class... >
class Container,
35 : _canContinue(
std::move(canContinue) ){};
43 void operator()( Container< std::shared_ptr<AsyncOp>, CArgs...> &&ops ) {
71 Container< std::shared_ptr<AsyncOp>, CArgs... >
_allOps;
79 template<
class,
class... >
class Container,
82 std::enable_if_t< detail::is_async_op_v<AsyncOp>, int> = 0
84 auto operator()( Container< std::shared_ptr< AsyncOp >, CArgs... > &&ops ) ->
zyppng::AsyncOpRef< Container<typename AsyncOp::value_type> > {
86 aOp->operator()( std::move(ops) );
91 template<
class,
class... >
class Container,
94 std::enable_if_t< !detail::is_async_op_v<Res>, int> = 0
96 auto operator()( Container< Res, CArgs... > ops ) -> Container< Res, CArgs... > {
102 template <
typename AsyncOpRes>
108 template<
class,
class... >
class Container,
111 std::enable_if_t< detail::is_async_op_v<AsyncOp>, int> = 0
113 auto operator()( Container< std::shared_ptr< AsyncOp >, CArgs... > &&ops ) ->
zyppng::AsyncOpRef< Container<typename AsyncOp::value_type> > {
115 aOp->operator()( std::move(ops) );
constexpr bool is_async_op_v
std::shared_ptr< AsyncOp< T > > AsyncOpRef
void setReady(value_type &&val)
WaitForHelperExt(std::function< bool(const AsyncOpRes &)> &&fn)
std::function< bool(const AsyncOpRes &)> _cb
void resultReady(AsyncOpRes &&res)
Container< std::shared_ptr< AsyncOp >, CArgs... > _allOps
WaitForImpl(const WaitForImpl &other)=delete
WaitForImpl(std::function< bool(const AsyncOpRes &)> canContinue={})
void operator()(Container< std::shared_ptr< AsyncOp >, CArgs... > &&ops)
WaitForImpl(WaitForImpl &&other)=default
typename AsyncOp::value_type AsyncOpRes
Container< AsyncOpRes > _allResults
std::function< bool(const AsyncOpRes &)> _canContinue