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 OpType
>
{
{}
return executor()->computeSomeInt()
std::cout<< "Int calculated as: " << result << std::endl;
});
}
protected:
};
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(){
}
};
}
AsyncOpRef<expected<int>> computeInt( ContextRef context ) {
return ComputeIntAsyncExecutor::run( std::move(context) );
}
expected<int> computeInt( SyncContextRef context ) {
return ComputeIntSyncExecutor::run( std::move(context) );
}
Reference counted access to a Tp object calling a custom Dispose function when the last AutoDispose h...
#define ZYPP_ENABLE_LOGIC_BASE(Executor, OpType)
ResultType and_then(const expected< T, E > &exp, Function &&f)
Definition at line 161 of file logichelpers.h.