9 #ifndef ZYPP_NG_LOGICHELPERS_INCLUDED 10 #define ZYPP_NG_LOGICHELPERS_INCLUDED 12 #include <zypp-core/ng/async/awaitable.h> 19 template <
typename Op,
typename =
void>
22 template <
typename Op>
38 static constexpr
bool is_async = ZYPP_IS_ASYNC;
51 #define ZYPP_ENABLE_MAYBE_ASYNC_MIXIN( IsAsync ) \ 53 using MaybeAsyncRef = MaybeAwaitable<T> 148 template <
typename Executor,
typename OpType>
152 using Result =
typename OpType::value_type;
157 template <
typename ...Args>
158 static auto run( Args &&...args ) {
159 #ifdef ZYPP_ENABLE_ASYNC 160 auto op = std::make_shared<Executor>( std::forward<Args>(args)... );
164 return Executor( std::forward<Args>(args)... ).execute();
173 return static_cast<Executor *
>(
this);
177 #ifdef ZYPP_ENABLE_ASYNC 178 void asyncExecute() {
179 this->_innerPipeline =
static_cast<Executor*
>(
this)->execute();
180 this->_innerPipeline->onReady([
this](
auto &&val ){
181 this->setReady( std::forward<decltype(val)>(val) );
191 template <
typename Result>
197 template <
template<
typename,
typename>
typename Logic ,
typename OpType>
201 template <
typename ...Args>
210 #define ZYPP_ENABLE_LOGIC_BASE(Executor, OpType) \ 211 using LogicBase<Executor, OpType>::executor; \ 213 using MaybeAsyncRef = typename LogicBase<Executor, OpType>:: template MaybeAsyncRef<T>
SimpleExecutor(Args &&...args)
AsyncOpRef< typename Op::value_type > _innerPipeline
typename enable_if< B, T >::type enable_if_t
MaybeAwaitable< Type > MaybeAsyncRef
static constexpr bool is_async
typename OpType::value_type Result
static auto run(Args &&...args)