template<typename Executor, typename OpType>
struct zyppng::LogicBase< Executor, OpType >
Logic base class template, this allows us to implement certain workflows in a sync/async agnostic way, based on the OpType the code is either sync or async:
namespace {
template <
typename Executor
, typename OpType
>
struct ComputeIntLogic :
public LogicBase<Executor, OpType>
{
LogicImpl( ZyppContextRefType ctx )
{}
std::cout<< "Int calculated as: " << result << std::endl;
});
}
protected:
ZyppContextRefType _ctx;
};
class ComputeIntAsyncExecutor : public ComputeIntLogic<ComputeIntAsyncExecutor, AsyncOp<int>>
{
using ComputeIntLogic<ComputeIntAsyncExecutor, AsyncOp<int>>::ComputeIntLogic;
AsyncOpRef<expected<int>> computeSomeInt() {
}
};
class ComputeIntSyncExecutor : public ComputeIntLogic<ComputeIntAsyncExecutor, SyncOp<int>>
{
using ComputeIntLogic<ComputeIntAsyncExecutor, SyncOp<int>>::ComputeIntLogic;
expected<int> computeSomeInt(){
}
};
}
return ComputeIntAsyncExecutor::run( std::move(context) );
}
expected<int> computeInt( SyncContextRef context ) {
return ComputeIntSyncExecutor::run( std::move(context) );
}
static expected success(ConsParams &&...params)
#define ZYPP_ENABLE_LOGIC_BASE(Executor, OpType)
std::shared_ptr< AsyncOp< T > > AsyncOpRef
ResultType and_then(const expected< T, E > &exp, Function &&f)
std::conditional_t< detail::is_async_op_v< OpType >, ContextRef, SyncContextRef > MaybeAsyncContextRef
std::conditional_t< isAsync, AsyncOpRef< Type >, Type > MaybeAsyncRef
Definition at line 161 of file logichelpers.h.